Author Topic: A way to know what timezone you are in? [Solved]  (Read 794 times)

Is there a way to know what timezone you are in?
« Last Edit: May 23, 2015, 09:28:21 PM by Advanced Bot »

Use getDateTime() to get the current server time, then compare it with something like UTC (i.e. use a HTTPObject to download it from http://www.timeapi.org/ and subtract it)

Figured that a HTTPObject/TCPObject would be the only way, thanks

Please note that naively subtracting one time from another will cause the presumed timezone to change back one hour if the user is in an area and time where DST is observed, and will cause the presumed timezone to change forward one hour if DST isn't being observed, and you assume it is and adjust for it.

What Xalos said
UTC offset and timezone are different things; the former is part of the latter. Not all timezones observe DST, and when they do, the start and end date varies between timezones.
Not all even change by one hour, there are a few that change by 30 minutes


Now, depending on what you're using it for, UTC offset may be sufficient. However, if it's the actual timezone you want, you'll need to do some sort of geolocation based on IP

Use https://freegeoip.net/ or something brown townogical.

Use https://freegeoip.net/

That's just the timezone of where your internet provider says you live, not the timezone your computer is actually configured to use

Seems irrelevant in most cases.

That's just the timezone of where your internet provider says you live, not the timezone your computer is actually configured to use
Yeah but I'm like 99% sure you can't get the latter via torque