Timezone from Mobile device?

0
Hi all, Is there anyway to get the the timezone from a mobile device instead of the timezone configured for that user? We have a phonegap application and we’d like our user to be able to log times correctly when they cross a timezone border without them having to change their timezone in settings….  Any guidance is much appreciated!
asked
2 answers
0

Hi Reinout,

You might be interested with cordova-plugin-globalization. If you use getDatePattern method, you can retrieve the client’s time format properties, including the timezone.

answered
0

Logging the time is not a problem since times are stored as a UTC timestamp anyway. What you do need to know is the offset that should be applied at the given location and time. The best way is probebly to autodetect this using the plugin that Rionald suggested or you could try to pinpoint the location when the time was logged and based on that location somehow determine the offset at the given time.

Edit: 

Most of the cases this should only be an issue if you want to display the time, because for calculations you are best off applying the utc time.

answered