I had a iphone app, the code has a method to retrieve current time stamp from iphone and upload to server. Here is my code: long long timestampMillis = (long long)([[NSDate date] timeIntervalSince1970] * 1000); However, one of customer use the app in Japan sent data shown on server is tomorrow开发者_运维百科 time. How can I retrieve UTC timestamp?
Thanks advanced
According to the NSDate
documentation, timeIntervalSince1970
should be returning the number of seconds since 1 January 1970 GMT (and GMT is just about synonymous with UTC), so that the same instant in time should yield the same timestamp, regardless of the local time. Are there any other conversions being done on your timestamp, in the application or on the server?
精彩评论