Clocks Applet

Back to Dave Eisenberg's Resume

This page is in response to a person who emailed me this:

I would like if you would be able to make a JavaScript which will indicate the different times of the different countries in the world which will be represented by different clocks.

Well, the answer is that, in Javascript, I can do a digital-only clock update (basically by rewriting a document with a frame).

However, I suspect my correspondent would prefer a picture of a clock face. To just update every minute from Javascript, you'd have to have 720 different images (one for every minute) and it would be a nightmare.

You really want Java to do this. I remembered seeing a similar application in the book Core Java by Gary Cornell and Cay S. Horstmann. Sure enough, there it was. I used it as inspiration (but didn't copy their code). The resulting applet produces what you see below. The clock face is light yellow during AM hours, and light blue during PM hours. Here are instructions on how to use the applet

Sorry, you don't have Java enabled. You won't be able to see the clocks.

Note: This applet will not function properly on Macintosh Netscape Navigator 3.01; there's a bug in their implementation of Java's getTimezoneOffset() function.

Download a .zip file with source and object code
Back to main index