Grad.java is a small Java applet that presents a countdown timer to a specified date and time, or the time elapsed if the specified time has already passed.
Grad.java supports the following applet parameters:
- bgcolor
- The background color of the applet, specified as a hexadecimal value. This value defaults to "#FFFFFF" (white).
- fgcolor
- The foreground color of the applet, specified as a hexidecimal value. This value defaults to "#000000" (black).
- target
- The target date to count down to or show elapsed time since. The value is specified in the format "YYYYMMDDhhmm" where YYYY is the year, MM is the month, DD is the day, hh is the hour, and mm is the minute. For example, "197406221520" would be June 22, 1974, at 15:20 (3:20pm). It is important to note that this time is specified in Greenwich Mean Time, so that the applet can make an accurate calculation no matter what time zone the user is in. For example, in the Central Time Zone, add 5 hours in the summer or 6 in the winter to arrive at the GMT time. The target date defaults to January 1, 2001, the beginning of the new millenium.
- before
- A string to display beneath the countdown if the target date and time has yet to arrive.
- after
- A string to display beneath the elapsed time if the target date and time has already passed.
As an example, the applet invoked at the top of this page is specified with the following bit of HTML:
<applet width=320 height=40 code="Grad.class"> <param name="bgcolor" value="#FFFFFF"></param> <param name="fgcolor" value="#000000"></param> <param name="target" value="200101010000"></param> <param name="before" value="until the new millenium begins (GMT)"></param> <param name="after" value="since the new millenium began (GMT)"></param> </applet>
Why is this program called "grad"?
The original incarnation of this program was a small C program I wrote back in 1993 to count down the seconds until my high school graduation.
Download Grad.class
Download Grad.java source code