I am trying to get a user’s timezone. I can do this, but how can I identify two geographic zones with same timezone, for example Arizona timezone is UTC-07:00 same that Mountain time (US & Canada) and when I get timezone from user I only get -07:00, but I don´t know if user is in Arizona timezone or Mountain time timezone. Any hint about how to identify this?
I need something like this code in Java:
TimeZone tz = Calendar.getInstance().getTimeZone();
System.out.println("TimeZone: "+tz.getDisplayName());
System.out.println("ID: "+tz.getID());
but for javascript.
Edit: I think I found a simpler answer to your problem. Look at the code at the bottom of this post.
Well, Arizona’s time zone is the same as Mountain time zone. Therefore if someone is in Arizona time zone, they are also in Mountain time zone, and vice-versa. The two timezones are one and the same.If you are just looking for your user’s geographical location however, try using this relevant api in conjunction with some code that looks like this.
Basically what is done in this code is:
Your user’s machine accesses geoplugin.net, which then returns info relating to the user’s IP address.
You parse the returned data and do whatever you want with it.
Hope this helps!