Home  |  About  | Last |  Submit  |  Contact
AllQuests.com

Previous Question:  Tiger Woods Question  Xbox 360 GamesNext Question:  AJAX Upload Progress  Scripting Client Side
Question Javascript Getting invalid Time Zone ( CodeGuru Forums Scripting Client Side )
Updated: 2008-08-12 06:08:51 (2)
Javascript Getting invalid Time Zone

I have found following piece of code for client time zone:
Code:
alert((new Date().getTimezoneOffset()/60) * -1)


It works fine for positive time zone. But when set negative time zone on system. I got one hour later e.g. if i set -8 time zone on system then i got -7.
ANY IDEA HOW CAN I RESOLVE IT?


Answers: Javascript Getting invalid Time Zone ( CodeGuru Forums Scripting Client Side )
Javascript Getting invalid Time Zone

getTimezoneOffset only gets hoe many hours you are off of GMT. It will never produce a negative. If you know that you are in need of a negative just use the following.

Code:
var d = new Date(); offsetGMT = -(d.getTimezoneOffset() / 60);



Javascript Getting invalid Time Zone

Ok i resolve the problem. It is showing me one hour difference because on my system "Automatically adjust clock for day light saving" is on.

Waqas_Badar

Previous Question:  Tiger Woods Question  AVForums  Xbox 360 GamesNext Question:  AJAX Upload Progress  CodeGuru Forums  Scripting Client Side

- Source: Javascript Getting invalid Time Zone CodeGuru Forums Scripting Client Side
- Previous Question: Tiger Woods Question AVForums Xbox 360 Games
- Next Question: AJAX Upload Progress CodeGuru Forums Scripting Client Side





AllQuests.com


Best dedicated servers   Top dedicated servers   Cheap dedicated servers   Linux dedicated servers   Windows dedicated servers   Unmetered dedicated servers