开发者

Syncing data from iphone to the server Datetime question

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜