Time zone offset and day light saving. 
Author Message
 Time zone offset and day light saving.


I wrote a script for my site some times ago which is supposed to show the
local time and my time according to the time zone of the visitors of my
page. Everything seemed OK to me up to last weekend when one moved our
clocks one hour forward. Now my script does not work.
In IE5 the locale time shown is 1 hour behind the current locale time but in
NS4 it is OK. About the time shown for "my time" it is OK in IE5 (if one
takes the hour shift of the locale time) but it seems there is a problem
with NS4.
I compared the values returned by getTimezoneOffset and IE5 and NS4 gives
different results! Here are some:

offset     IE5     NS4
GMT-5:  300     300
GMT:     0         -60
GMT+1 : -60     -120

Here is my script:

function getTimeString(time)
 var str = time.toLocaleString();
  var index = str.lastIndexOf(" ");
 if (index < 0)
  return "";

 return str.substring(index+1);


function ShowTimes()
 var loctime = new Date();
 var offset = loctime.getTimezoneOffset() + 60; // I am in Romance Time Zone

 var owntime = new Date(loctime.valueOf() + (offset * 60000)); // in ms

 document.time.locale.value = getTimeString(loctime);
 document.time.owner.value = getTimeString(owntime);



Do you have an idea how to correct this problem? Thanks.


Microsoft SBN Level 2 member
Windows 98 Service Release beta tester

Sat, 15 Sep 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Get GMT (day light savings) Offset

2. time zones and daylight saving time

3. day-light savings

4. Saving open file and opening new file at a specified time of day

5. Time & Time Zones

6. Formatting Time to GMT when current Time Zone not known

7. Real time From Time Zone information

8. 6 Color driver (CMYK + Light cyan + Light magenta)

9. Determine Time Zones???

10. time zone

11. Chaniging time zone

12. Time Zone Question for Torgeir


Powered by phpBB® Forum Software