I'm seeing an odd behavior with trying to get seconds since epoch in objective C. This:
NSString *nowTimestamp = [NSString stringWithFormat:@"%d",
[[NSDate date] timeIntervalSince1970]];
Outputs 15907296, when the current timestamp should be 1243555623 (05/28/2009 @ 7:08pm EST). The system time on the iPhone is correct. I can't figure out for the life of me what I'm doing wrong. Any recommendations?
timeIntervalSince1970 returns an NSTimeInterval, which is a typedef for double; %d is not the right formatter to print a double (you want %f).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With