Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1479 How can I have a clock on a webpage that syncs with the Atomic clock?

irt.org | Knowledge Base | JavaScript | Date | Q1479 [ previous next ]

Q1479 How can I have a clock on a webpage that syncs with the Atomic clock?

Have an image and change the source:

<script language="JavaScript"><!--
function showTime() {
   if (!document.images) return;
   now = new Date();
   document.images["theTime"].src = 'http://tycho.usno.navy.mil/cgi-bin/xbmclock.xbm?zone=GMT&'+ now.getTime();
   setTimeout('showTime()',60000); // update once a minute or they will be cross...
}
//--></script>

<img name="theTime" src="http://tycho.usno.navy.mil/cgi-bin/xbmclock.xbm?zone=GMT" width=192 height=28>

More info (timezone and such) at http://tycho.usno.navy.mil/howclock.html


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.