| 
 
 
 
 | Right click this window and select "view source" in order to copy the source for this script. 
 
 
| #!/usr/local/bin/perl
 ######################
 # Define Variables
 
 $Display_Week_Day = '1';
 
 $Display_Month = '1';
 
 $Display_Month_Day = '1';
 
 $Display_Year = '1';
 
 $Display_Time = '1';
 
 $Display_Time_Zone = '1';
 
 $Standard_Time_Zone = 'EST';
 $Daylight_Time_Zone = 'EDT';
 
 $Display_Link = '1';
 
 # Done
 ######################
 
 @Week_Days = ('Sunday','Monday','Tuesday','Wednesday',
 'Thursday','Friday','Saturday');
 
 @Months = ('January','February','March','April','May','June','July',
 'August','September','October','November','December');
 
 
 print "Content-type: text/html\n\n";
 
 
 ($Second,$Minute,$Hour,$Month_Day,
 $Month,$Year,$Week_Day,$IsDST) = (localtime)[0,1,2,3,4,5,6,8];
 
 if ($IsDST == 1) {
 $Time_Zone = $Daylight_Time_Zone;
 }
 else {
 $Time_Zone = $Standard_Time_Zone;
 }
 
 if ($Second < 10) {
 $Second = "0$Second";
 }
 if ($Minute < 10) {
 $Minute = "0$Minute";
 }
 if ($Hour < 10) {
 $Hour = "0$Hour";
 }
 if ($Month_Day < 10) {
 $Month_Day = "0$Month_Day";
 }
 $Year += 1900;
 
 if ($Display_Week_Day != 0) {
 print "$Week_Days[$Week_Day]";
 if ($Display_Month != 0) {
 print ", ";
 }
 }
 
 if ($Display_Month != 0) {
 print "$Months[$Month] ";
 }
 
 if ($Display_Month_Day != 0) {
 print "$Month_Day";
 if ($Display_Year != 0) {
 print ", ";
 }
 }
 
 if ($Display_Year != 0) {
 print "$Year";
 if ($Display_Time != 0) {
 print " - ";
 }
 elsif ($Display_Time_Zone != 0) {
 print " ";
 }
 }
 
 if ($Display_Time != 0) {
 print "$Hour\:$Minute\:$Second";
 if ($Display_Time_Zone != 0) {
 print " ";
 }
 }
 
 if ($Display_Time_Zone != 0) {
 print "$Time_Zone";
 }
 
 if ($Display_Link != 0) {
 print "";
 }
 
 exit;
 
 # Instructions below
 
 
 # TxtClock is a Perl CGI script which is meant to be run from Server Side
 # Includes.  For more information on Server Side Includes, check out the
 # FAQ at the URL mentioned above.  When this script is implemented, it can
 # be used to show browsers several variations of the current time and/or
 # date.
 
 
 # Should you encounter any problems running this script, such as Method Not
 # Implemented, try changing the name of the program to nph-txtclock.cgi,
 # as some servers require the use of .cgi extensions.  Otherwise, this
 # script must be placed in your cgi-bin.  There are several variables which
 # must be edited in the txtclock.pl script.
 
 # TXTCLOCK.PL -
 
 #     There are up to nine variables in the txtclock.pl script, however
 #     if you wish to receive the default display, you need not edit any
 #     of them.  You can mix and match all of these options and see which
 #     kind of clock you like the best.  You can get the clock to display
 #     only the day of the week, only the date, only the time, everything
 #     or make up your own combination!
 
 #	$Display_Week_Day = '1';
 #		If this option is set to '1', the day of the week will be
 #		displayed; Possible Values: Monday, Tuesday, Wednesday,
 #		Thursday, Friday, Saturday and Sunday.  Setting this option
 #		to '0' will suppress the printing of the Day of the Week.
 
 #	$Display_Month = '1';
 #		If this option is set to '1', the month will be printed.
 #		Possible values include: January, February, March, April, May,
 #		June, July, August, September, October, November and December.
 #		If this option is set to '0', the month will not be displayed.
 
 #	$Display_Month_Day = '1';
 #		If this option is set to '1', the day of the month is
 #		displayed, containing a value from 01 - 31.  Setting this to
 #		'0' will hide the Day of the Month.
 
 #	$Display_Year = '1';
 #		If this option is set to '1', the four digit year is
 #		displayed, and it can be hidden by setting this to '0'.
 
 #	$Display_Time = '1';
 #		If this option is set to '1', a twenty four hour clock is
 #		displayed.  Otherwise, if it is set to '0', it is supressed.
 
 #	$Display_Time_Zone = '1';
 #		Setting this to '1' allows users to your site to know what
 #		time zone the date is being displayed from.  If it is set
 #		to '1', the script will determine if it is Daylight Savings
 #		or not.  If so, it uses $Daylight_Time_Zone as the Time Zone
 #		to display.  Otherwise it uses $Standard_Time_Zone.
 
 #	$Standard_Time_Zone = 'EST';
 #	$Daylight_Time_Zone = 'EDT';
 #		These are the names of your Time Zones.  The ones shown above
 #		represent Eastern Coast Time Zones.  Other ones in the US
 #		include Central Time (CST/CDT), Mountain Time (MST/MDT) and
 #		Pacific Coast Time (PST/PDT).
 
 
 
 
 ##########################
 
 #		How to Call This Script From Your Web Page
 #		------------------------------------------
 
 # Calling this script from a web page is fairly simple.  You just use a standard
 # Server Side Include call, such as:
 
 #	<!--#exec cgi="/url/path/to/txtclock.cgi"-->
 
 | SSI Perl Text Clock 
This routine will provide a text display of a server based time clock; the time is derived from the server's time. The code is shown but this is NOT live. Be certain to use a proper PERL or CGI name extension on this program. You may directly highlight, copy and paste the above full program.
 |