I am getting epoch time in a json string, the time is coming in as:
1374493503000
I'm using the following code to convert the time:
//convert time since epoch to date
NSString* strTime = [dictThisEarthquakeProperties objectForKey:@"time"];
NSTimeInterval seconds = [strTime doubleValue];
NSDate* epochNSDate = [[NSDate alloc] initWithTimeIntervalSince1970:seconds];
NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
NSLog (@"Epoch time %@ equates to %@", strTime, [dateFormatter stringFromDate:epochNSDate]);
My result is this:
Epoch time 1374493503000 equates to UTC 45525-12-19 14:50:00 +0000
Any help/explanation would be appreciated.
Doh, nevermind, I was getting milliseconds from the json, not seconds.