views:

16

answers:

4

I'm working with some videogame server data. The server returns a dictionary with past game details. One of the fields is for the date. That returned object is a string like this:

/Date(1286749014000-0700)/

I'm not exactly sure how that string translates into the date, but it should represent Sunday, October 10, 2010, 3:16 PM.

Is this a Unix timestamp? Do they usually have a suffix like -0700?

Thank you

+1  A: 

The number 1286749014 stands for 10 october 2010 5:16:54 pm. So if you substract the 700 from it you should get the right date and time.

Check out the Wikipedia article on Unix time for more information on how it's made up.

Jeroen de Leeuw
Am I subtracting 700 from the first part of the timestamp?
JustinXXVII
You must subtract it from the current timestamp, for clarification on how timestamps work, use this site http://www.epochconverter.com/ on that site you can also give as input an human readable value.
Jeroen de Leeuw
A: 

The first part ("128674901") exactly represents "Sun, 10 Oct 2010 22:16:54 GMT" date.

In objective-c you can use something like this:

NSTimeInterval unixDate = 128674901;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:unixDate];
onecupofspam
A: 

It looks like you have a high resolution time with timezone offset.

John Percival Hackworth
A: 

The "0700" suffix is a time zone. Which means UTC -07

onecupofspam