Digital Clock

This applet creates basic clock. The time may be integrated into a text message for display. Also, the clock may be used to count down to (or up from) a specific time (referred to as 'Countdown Mode').

Downloading

The applet may be downloaded for free by clicking on the TAR-file link below (read the FAQ if you're not sure what to do with a TAR file). The FAQ also has step by step instructions on how to embed an applet into your own webpage.

DigitalClock2.tar

Once unTARed, you should find the following classes (plus a '.jar' file if you want to use the archive= attribute in the <applet> tag):

Parameters

Below are descriptions of all the parameters you may use to customize the applets to your webpages. Be sure to enclose any parameters that contain white space in double-quotation marks. Most parameters have default values in case you do not specify your own values, but the first two parameters (AUTHOR and COPYRIGHT) are necessary. If you are not sure how to incorporate an applet into a webpage (with its parameter names and values), looks at the source of this webpage and the applet embedded for an example, or read the FAQ page.

  • AUTHOR: This parameter must appear exactly as follows:
    <param name=AUTHOR value="Eric Harshbarger, http://www.ericharshbarger.org">
    

  • COPYRIGHT: This parameter must appear exactly as follows:
    <param name=COPYRIGHT value="DigitalClock applet, Copyright 1998, Eric Harshbarger">

  • BACKGROUND: This parameter points to an image file that is used as a background to the applet. All the various texts of the applet will be painted on top of this image. Consult the FAQ page if you are unsure about what image formats you may use.

  • BGCOLOR: This parameter indicates the background color of the applet. Consult the FAQ page if you are unsure what format to use for the parameter's value.

  • FGCOLOR: This parameter indicates the foreground color of the applet. Consult the FAQ page if you are unsure what format to use for the parameter's value.

  • FONTNAME: This value indicates the fontface used by the applet. Java1.0.2 has the following values from which to choose (must be spelled exactly): TimesRoman, Dialog, Courier, Helvetica, DialogInput, Symbol.

  • FONTSIZE: This value indicates the size of the font used by the applet.

  • FONTSTYLE: This value indicates the style of the font used by the applet. The value should be one of the following: plain, bold, italic, bolditalic.

  • COUNTDOWN.TIME: 6 numbers separated by commas that represent, respectively: year, month, date (of month), hours, minutes, seconds. The time indicated is the time the clock is 'counting down to' (as opposed to just displaying the current time). Note that the months are ordered as follows: 0=Jan, 1=Feb,... 11=Dec (12 does NOT equal Dec). The default is that the clock is not in Countdown Mode... rather it just displays the current time.

  • COUNTDOWN.BEFORE: The message displayed in the applet during Countdown Mode as long as the COUNTDOWN.TIME has not been reached. Within the message, special strings may be used to have the appropriate time variables substitued in before display:
    %day%     =     'day value'
    %hour%    =     'hour value'
    %min%     =     'minute value'
    %sec%     =     'second value'
    %msec%    =     'milliseconds value'
    
    The default is 'Countdown: %day%, %hour%:%min%:%sec%'.

  • COUNTDOWN.AFTER: The message displayed in the applet during Countdown Mode after the COUNTDOWN.TIME has been reached (and the clock is counting the days, hours, minutes, and seconds after the specified time). The substitute values for inserting the time elements into the message are the same as COUNTDOWN.BEFORE. The default is 'Your time has passed %day% days, %hour% hours, %min% minutes, and %sec% seconds ago.'

  • TIME.DISPLAY: This is the message displayed by the clock when not in Countdown Mode... just normal mode. Within the message, special strings may be used to have the appropriate time variables substitued in before display:
    %year%     =     'year value minus 1900' **
    %mon%      =     'month number'
    %mon_name% =     'month name' (see MONTHS parameter)
    %mday%     =     'day of month value'
    %wday%     =     'day of week value'  (see WEEKDAYS parameter)
    %hour%     =     'hour value'
    %min%      =     'minute value'
    %sec%      =     'second value'
    %ampm%     =     'either am or pm if 24HOURS is false'
    %AMPM%     =     'either AM or PM (capitalized) if 24HOUR is false'
    
    ** Note that the %year% is actually calculated by adding 1900 to whatever value
    you input. SO THE DIGITALCLOCK IS YEAR 2000 READY; if you want to indicate 2000
    use '100' (1900 + 100 == 2000). For 2031 you would use '131' (1900 + 131 == 2000).
    
    The default is '%mday% %mon_name% %year% %hour%:%min%:%sec%'.

  • ESCAPE.CHARACTER: If you wish to use the '%' sign in your messages (in either mode), this could conflict with the time element substitutions. This parameter allows you to change the 'escape character' that must surrond each time element name.

  • 24HOUR: If 'true', the TIME.DISPLAY will denote the hours of time on the 24-hour system and ignore any AM/PM indication.

  • DECIMAL.PLACES: The %msec% time-element in Countdown Mode is supposed to display three decimal places (since one is dealing with milliseconds). However, on some systems, it appears that milliseconds are actually rounded off to hundredths of a second, meaning the final decimal place is always a 0. This destroys the 'dramatic effect' of a countdown if the last digit never changes, so the default is that %msec% will actually only display out to hundredths of a second (DECIMAL.PLACES = '2'). You may change the DECIMAL.PLACES value with this parameter if you wish (if you want only tenths of seconds... set equal to '1').

  • MONTHS: For the %mon_name% time-element substitution, the standard month abreviations are the default: 'Jan Feb Mar...' You may change the Strings used by creating a space delimited list (for example if you wanted to spell out the months: 'January February March...').

  • WEEKDAYS: For the %wday% time-element substitution, the standard weekday abreviations are the default: 'Sun Mon Tue...' You may change the Strings used by creating a space delimited list (for example if you wanted to spell out the weekday names: 'Sunday Monday Tuesday...').

  • TIMEZONE.OFFSET: When in normal mode the DigitalClock applet will typically display the time according to the machine of the web user's local computer. If you would like to force the time to be in a certain time zone (say, always Pacific Time), you may set the TIMEZONE.OFFSET value. The offset value is the number of minutes away from the GMT (negative means west, positive east). Note that this is not an hour offset (multiply by 60). For example, Pacific Daylight Time can be forced by using '-420' (-8 TZ shift * 60 + 60 minutes for Daylight time -- during the summer, at least). Note the 'should', the timezone shifting business is not always perfect. Major problems include that people often have the time on their computers correct, but the timezone incorrect, and Java1.0.2 does not provide an easy way to detect 'Daylight Savings Mode'. These can mess up the outcome, so I'm not guaranteeing this to work all the time.

  • SPEED: This is the number of milliseconds between updates for the applet. The default is '900'. Note that if you are using the %msec% substitution in Countdown Mode you might want to lower this value to a smaller (faster) value to increase the apparent countdown speed (say down to '73' or something).

  • ALIGN: The messages displayed in the applet area may be aligned within the applet area with either the values 'left', 'right', or 'center'. The default is 'center'.



    APPLET DEPOT: INTRO - NEWS - APPLETS - DEMOS - CUSTOM - FAQ - EMAIL
    The Applet Depot and all associated applets, text, scripts, and images, Copyright © 1998-2002 by Eric Harshbarger unless otherwise noted. 'Java' is a registered trademark of Sun Microsystems Incorporated.