(mm) Digital world clock in Java
Home | Software | Count
  ansi xterm
  web counter
  bangla font
MS Windows

Dgclock in Java

Version 2.3

Latest Release: Nov 15, 1996
Initial Release: Dec 05, 1995

Spanish translation: http://www.webhostinghub.com/support/es/misc/dgclock-en-java
Thanks to Maria Ramos.

This is a simple digital clock written in Java. This clock can display time and date of any place in world. The time can be displayed in 12 hour or 24 hour format. The foreground and background colors of the digits can be changed. The clock can be wrapped with a ornamental frame as well.

You will need a java capable browser like netscape in order to view the clock. I compiled and tested the applet on DEC OSF/1 3.2 with JDK 1.0.2 and netscape 3.01.

This applet uses double-buffering technique, therefore, you should not see any flickering at all.

NOTE: Java applets can not handle daylight saving time. Therefore, use the TZ parameter accordingly. I'll have a workaround as soon as get some time.

Examples (screenshot)

jdgclock screen shot

What's new

  • [implemented in 2.3]
    Foreground and Background color can be changed.

  • [implemented in 2.2]
    Uses an image strip instead of individual digit images. Therefore, this version loads much faster. The name of the strip image is dgstrip.gif and it is only 700 bytes. The strip image must be located in the same directory as Dgclock.class. The strip looks like below:

How to use it

If you want to use this applet in your web page, you have to download the archive first. Then, you have to extract the necessary files from the archive. The archive is available in 3 formats, gzipped tar, unix compressed tar and zipped archive.

Download any one of the archives depending on what kind of de-compressor you have.


Download gzipped tar:
gzipped source/class
File: jdgclock2.3.tar.gz
Size: 14754 bytes
MD5 Checksum: 6f6c1918935c78e77fca221fd8103150
Last updated: ?

Unix compressed source/class
File: jdgclock2.3.tar.Z
Size: 23532 bytes
MD5 Checksum: 424956877a91ed2578eb8225e9c9f691
Last updated: ?

zipped source/class
File: jdgclk.zip
Size: 15662 bytes
MD5 Checksum: 73c6d894f9a614a3bdc2e0ce11ff5f3a
Last updated: ?

The following files will be extracted to the current working directory. Make sure you do not have any files with those name in the directory or they will be over written.

You need Dgclock.class, ColorFilter.class and dgstrip.gif in order to run the applet.

Please consider NOT running the applet remotely from this machine.

After downloading, copy the archive to your public_html directory (or wherever you keep your home pages).

If you downloaded the gzipped version, at the shell prompt, type:

    gunzip < jdgclock2.3.tar.gz | tar xvf -
    gzip -d < jdgclock2.3.tar.gz | tar xvf -
If you downloaded the unix compressed version, at the shell prompt, type:
    uncompress jdgclock2.3.tar.Z
    tar -xvf jdgclock2.3.tar
If you downloaded the zipped version, type:
    unzip jdgclk.zip

You do not need to compile the code in order to use it. Dgclock comes with pre-compiled classes Dgclock.class and ColorFilter.class. If you want to play with the source, please look at Dgclock.java (it is in the distribution as well).

Now, from your web page, call the applet as below:

    <applet code="Dgclock.class" width=100 height=30></applet>
This will show the visitor's time in 24 hour format. To display the time in 12 hour format, use:
    <applet code="Dgclock.class" width=100 height=30>
    <param name="TimeFormat" value="%I">
To display your time, you have to know your timezone offset from GMT. For example, if you live in New York, your timezone offset is 5 hours east of Greenwich meridian. Note, offset is negative for east and positive for west.

For New York:

    <applet code="Dgclock.class" width=100 height=30>
    <param name="TZ" value="GMT-0500">

Note, you can not use just -5, you must use the four digit offset starting with GMT+ or GMT-. If your timezone offset is 4 hours, 30 minutes west of Greenwich meridian, the param line will be:

    <param name="TZ" value="GMT+0430">
To display GMT, the param line will be:
    <param name="TZ" value="GMT+0000">
To display date with time:
    <applet code="Dgclock.class" width=100 height=30>
    <param name="TZ" value="GMT-0500">
    <param name="ShowDate" value="yes">

If you do not want to display the frame around the clock, use:

    <applet code="Dgclock.class" width=89 height=20>
    <param name="ShowFrame" value="no">

If you move the mouse cursor on the clock while it is running, the version information is displayed on netscape's status area. If you do not want this, use:

    <param name="ShowVersion" value="no">
If ShowVersion is "no", when the mouse pointer is moved over the clock, it will display the timezone offset from GMT in the netscape status area.

To change the foreground and background color of the digits, the parameters fg and bg can be used respectively.

    <param name="fg" value="red">
The value of fg and bg can be one of the following color names
    magenta, yellow,orange,
a 6 digit hex number like ff0000. Example:
    <param name="fg" value="yellow">
    <param name="bg" value="red">

    <param name="bg" value="d3b5b5">
    <param name="fg" value="000000">



Inspired by World TIme applet and Clock2 applet.


This applet is in the public domain. Do anything you like with it. It would be nice but not required if you give me the credit for it.If you are using this applet, please let me know. Bug reports, suggestions are always welcome!

Frequently Asked Question(s)

1. I followed your instructions exactly, but the clock does not show up. Instead it shows a solid rectangle. What's wrong?

Several things may cause this problem:

  1. File permission problem. Change the mode of the files accordingly (unix):
        chmod 644 ./Dgclock.class
        chmod 644 ./ColorFilter.class
        chmod 644 ./dgstrip.gif
    If you see the message Loading image...please wait! at netscape's status message area for ever, this is an indication that the image loading has failed possibly because it could not find the strip image file dgstrip.gif or the image file is are not readable.

  2. You are using an old version of web browser.

  3. You'r running your browser in MS Windows platform. I've been told that exiting and restarting the browser helps. Sometimes rebooting helps. I do not know why it happens, but I assume it has something to do with the java implementation in the browser on that platform. I never saw any problem with netscape running on Linux and DEC OSF1.


Version 2.3
  • Foreground and Background color can be changed. (11/15/1996).
Version 2.2
  • Uses image strip instead of individual digit images. (11/02/1996)

Version 2.1

  • The default 24 hour time format was not working. Thanks to Amy and Cary for pointing it out. (March 20, 1996).

  • Using MediaTracker class to avoid incremental display of digit images. That is, the time will be displayed after all the images are loaded completely. Suggested by Jim Graham

  • The clock can be displayed without frame (default is to use frame).

  • The clock can be stopped by clicking a mouse button on the applet. Clicking again will restart the clock.

  • Displays "Loading image.." message at netscape's status area while the images are being loaded.

Last updated: November 15, 1996.

URL of this page: http://www.muquit.com/muquit/software/jdgclock/jdgclock.html

back Page updated: Sun Mar 31 01:59:56 2013 GMT   Copyright © 2013 muquit@muquit.com.