开发者

Syncing data from iphone to the server Datetime question

开发者 https://www.devze.com 2022-12-24 01:50 出处:网络
I want sync data from iphone to the webs server. My question is how can I know which data is new? the only way I see this is by making a datafield for each record on the server and the iPhone, but how

I want sync data from iphone to the webs server. My question is how can I know which data is new? the only way I see this is by making a datafield for each record on the server and the iPhone, but how about if the Iphone user is in a different timezone or his datetime is different from the server dateti开发者_Go百科me.


Store all of your dates in GMT on both the server and device. There are several methods for getting GMT easily in Objective-C. The device will determine time-zone based on location. If you need to convert to local time, you can get the date by using the NSTimeZoneClass:

[NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone defaultTimeZone] secondsFromGMT]]

Check out the docs on Date and Time Programming for additional assistance.

0

精彩评论

暂无评论...
验证码 换一张
取 消