I am in the process of developing SMS based app. When my app launches I select the last-message-date-time from database and send it to the server and I get back all the messages with date-time > last-message-date-time but because the app and server may not be in the same timezone I can't get the correct result. What is the best way to fix this issue? Please help. Thank you.
This question is the follow up of update SQLite with content of push notification when the app is not running.
One of the options is to store the time stamp in UTC/GMT on server, and when you get the date from server, convert it to local date object using GMT as formate, then show the user to their local timezone using formatters. ie.
NSDateFormatter with GMT/UTC as timezone to convert it to NSDate object in Objective-CNSDateFormatter with local timezone to show it to user.Keep in mind that NSDate holds the date as independent of timezones so when showing it to user, use any NSDateFormatter to convert it to local or any timezone.
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