Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Zone

Status
Not open for further replies.

NWHippie

Programmer
Jul 27, 2007
5
0
0
US
Hi everyone. I'm needing help with trying to determine what my visitor's time zone is to my web page. I have tried using the JavaScript's date object's method getTimeZoneOffset(). This works fine to give me the GMT minus what ever hours to get their timezone. However, I'm having trouble with Arizona in particular. Arizona does not observe DST so basically when I use the getTimeZoneOffset() it gives me the time zone for Mountain Time which is what Arizona truly is. However, during DST, Arizona's time looks like Pacific time. I need to be able to display the correct user's time and their corresponding time zone (ET, CT, MT, PT). So the problem is during DST, getTimeZoneOffset() tells me Arizona is in Mountain time but they don't observe DST which makes them an hour behind MT but I need to have my page display their correct time (1 hour behind MT) then displaying the initial MT after the time to indicate the time zone. Does anybody know how to handle for this?
 
If the time isn't crazy important, you can just pull the time off the local PC.

[monkey][snake] <.
 
The time isn't really important, but my company doesn't want to pull the user's time because some users don't have the correct time. Simply pulling the time off the PC also doesn't give me the time zone either.
 
This is a tough question because you will have to know geographically where the user is located.

This is also more of a server side language question.

[monkey][snake] <.
 
Yeah, this is a very hard question. I've been racking my brain and other's in my department. What we started off trying to do is get the user's time zone offset from GMT and then have the server side to the conversion. The only state we have trouble with is Arizona who is in MT time zone but during DST their time is the same as Pacific Time. Is there anything that can help me with their location?
 
You were able to figure out Indiana? That has got to be the craziest state for time-zone irregularities. Parts are Eastern, parts are Central, and some parts don't follow Day-light Savings Time.

If you can make it (work) there .... well, you know.

Einstein47
There are no kangaroos in Austria!
[&#91;]Starbase47.com]
 
According to research that I have done, Indiana is no longer a problem. I guess the whole state started observing DST in 2005 whether it be central or eastern time. So they aren't a problem anymore since the getTimeZoneOffset returns to me the correct time zone there computer is in. They'll either have their computer set to EST or CST and adjusted for DST automatically. Arizona is the only state in the 48 connected states that doesn't observe DST. Hawaii is the only other state that doesn't observe it but they are in a completely different time zone by themselves.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top