Get Timezone or Local time

I need to compare the time on the user’s device with a time specified in a text document on a web server that is based on GMT 0. Are there any APIs capable of accessing the device’s local timezone or any hacks to overcome this?

Thanks, Luke [import]uid: 75643 topic_id: 15523 reply_id: 315523[/import]

You can easily get the time the device is set to, is that something that would work for you or are you doing something that requires anti-cheating strategies be implemented? [import]uid: 10144 topic_id: 15523 reply_id: 57376[/import]

I only need to be able to grab a copy of the timezone so I can inform the player when the next event starts. Eg. If the user’s timezone is set to GMT - 4, I want to be able to subtract 4 hours from the displayed time.

Luke. [import]uid: 75643 topic_id: 15523 reply_id: 57383[/import]

I have two suggestions.

The first, supposing you’re simply trying to display the current time in their location, would be to use this API; http://developer.anscamobile.com/reference/index/osdate

The second would be using the GPS; http://developer.anscamobile.com/content/location-gps

The first would be far simpler if it suits your needs :slight_smile:

Peach [import]uid: 52491 topic_id: 15523 reply_id: 57453[/import]

Thanks Peach, I skipped over the part about the conditional operator “!” accidentally. Again, thanks so much! [import]uid: 75643 topic_id: 15523 reply_id: 57466[/import]

Not a problem - I’m glad I was able to help :slight_smile: [import]uid: 52491 topic_id: 15523 reply_id: 57574[/import]