[ Bloke.com || Linux || JavaScript || Java || Volleyball || Link Me ]
Free: [ Guestbook || MessageBot || Plugins || Counter || AusPrices || Advertise ]

Bloke > JavaScript > Clock > Times around the World

This page written with Java Script implements a Clock. The only argument is the offset in minutes to GMT.

ServerClock() Note that GMT does not handle change if there is Daylight savings time, so if you are in a country that uses daylight savings, then you will need to change the offset when you are in daylight savings time.

Tech notes

In some old browsers the javascript function getTimezoneOffset returns a value that is one minute off . (at least on Solaris it returns -239 instead of -240).

They changed the definition of getTimezoneOffset() in 3.0, to be the reverse!!! Well here is the magic (urrgh)! [thanks to zoomer for noting the clock was wrong in 3.0]. The code included here works for netscape 1.1 and above (last checked at netscape 4.5.1) and I.E for the same times..

  d = new Date();
  if (navigator.appVersion.substring(0,3) == "2.0")
    realOffset = -d.getTimezoneOffset();
    realOffset = d.getTimezoneOffset();

How To

  • Java is a registered trademark of Sun Microsystems, Inc.

    See Also

    Got JavaScript questions? Maybe my JavaScript Board has the answers?

    Enter your Email to join my JavaScript List:
    (highly recommended if you use these scripts!)

    Powered by: MessageBot.com

    Cameron Gregory - cameron@bloke.com