If you've been surfing lately, you've probably noticed that many sites display the current date. Some do that in the form of an image, whereas others display the date as plain ASCII text. There are four ways to display the current date, each with its own pros and cons:
- Update the current date manually, every day. If you already update your site on a daily basis, this shouldn't be much of a problem.
- Setup a cronjob to update your site automatically at midnight. The easiest way to do this is to create a Perl script that manipulates your HTML document. Type
man 5 crontabat a Unix command prompt for more information on cronjobs, or continue reading this column for detailed instructions.
- Use a server-side include to execute a CGI program that prints the date in the desired format. The CGI program is executed once for each page request (HTTP request), so this method can be resource-demanding.
- How to create an instance of the
- How to extract the desired properties from that instance.
- How to display the date in a good-looking format.
- How to setup a cronjob to set the date.
- How to implement a server-side include to do the job.
Created: September 11, 1997
Revised: April 12, 2000