data.date = new Date(jObjectTip.getLong("createdAt") * 1000);
That command is used to grab data from FourSquare.
data.date = new Date(jObjectTip.getLong("createdAt") * 1000);
That command is used to grab data from FourSquare.
Uh...not sure what the "createAt" * 1000 means. 1000 times the current date and time?
In Objective C you can use:
to create a date time object with an offset:
// creates a date time that is 1000 seconds away from the current time
NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:1000];
Assuming that createdAt
is unix timestamp, the code will be:
NSTimeInterval createdAt = ...;
NSDate *resultDate = [NSDate dateWithTimeIntervalSince1970:createdAt];
Note that NSTimeInterval
is a typedef for double
, and it stores the time in seconds, unlike Java, so there's no need to multiply the value by 1000;