0

I have a string which I get from web-service response as "/Date(1366174800000-0500)/".

I want to convert the given string to NSDate with proper time stamp.

I am able to convert the 1366174800000(milliseconds) to NSDate using timeIntervalSince1970 API from apple, but I am not sure about the -500 appearing in the string.

Can somebody provide docs/examples for the same?

Regards,

Nirav

Nirav
  • 315
  • 1
  • 4
  • 16
  • 1
    can you do anything about the -500, usually its written by zero padding i.e, -0500. If that is so there are many solutions [Parsing JSON Dates on iPhone](http://stackoverflow.com/a/6065278/767730) – Anupdas May 07 '13 at 04:14
  • Thanks. It was -0500. I edited. and using the link you provided it worked. – Nirav May 07 '13 at 04:24

1 Answers1

1

-500 is the timezone. That is 5 hours, 0 minutes before GMT (which is normally Atlantic/Boston, aka ET).

GoZoner
  • 67,920
  • 20
  • 95
  • 145
  • I thought the whole point of timestamps were to make timezones irrelevant. A point in time is the same around the world, the only time timezones come into play is when you convert it to a local time. I'm not saying it is not correct (-0500 definitely looks like a timezone), but wouldn't the best advice be to ignore it? – borrrden May 07 '13 at 04:27