I have a timestamp measured in milliseconds since January 1, 1970, 00:00:00 UTC.
eg. input "takeoffTime": "1396614600000" output in date format
I have a timestamp measured in milliseconds since January 1, 1970, 00:00:00 UTC.
eg. input "takeoffTime": "1396614600000" output in date format
You can do this by doing the following:
[NSDate dateWithTimeIntervalSince1970:1396614600000/1000];
This will give you 2014-04-04 12:30:00 +0000
. You should read up on how to pass messages (call methods) here: How can I call a method in Objective-C?
The NSDate
class gives you this method + (instancetype)dateWithTimeIntervalSince1970:(NSTimeInterval)seconds
.
Look here: Apple docs
NSString* takeOffTime = @"1396614600000";
double miliSec = takeOffTime.doubleValue;
NSDate* takeOffDate = [NSDate dateWithTimeIntervalSince1970:miliSec/1000];