#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;

print header;
print start_html("Show Dates");

print "<pre>\n";

my @days = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
my @shortdays = qw( Sun Mon Tue Wed Thu Fri Sat );
my @months = qw(January February March April May June July August September October November December);
my @shortmonths = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

my ( $sec, $min, $hr, $mday, $mon, $year, $wday, $yday, $isdst ) =
  localtime(time);
my $longyr = $year + 1900;
my $fixmo  = $mon + 1;

my $tz = $isdst == 1 ? "CDT" : "CST";

# in case we only want the 2-digit year, like 00, we have 
# to do it the hard way...
my $yr2 = substr( $longyr, 2, 2 );

# 02/03/1999
printf( "%02d/%02d/%04d\n", $fixmo, $mday, $longyr );

# Wed, 03 Feb 99 12:23:55 CST
printf( "%3s, %02d %3s %02d %02d:%02d:%02d $tz\n", $shortdays[$wday], $mday,
    $shortmonths[$mon], $yr2, $hr, $min, $sec );

# Wed, 03 Oct 1999 12:23:55 CST
printf( "%3s, %02d %3s %04d %02d:%02d:%02d $tz\n", $shortdays[$wday], $mday,
    $shortmonths[$mon], $longyr, $hr, $min, $sec );

# Wednesday, 03-Feb-99 08:49:37 CST
printf( "$days[$wday], %02d-%3s-%02d %02d:%02d:%02d $tz\n", $mday,
    $shortmonths[$mon], $yr2, $hr, $min, $sec );

# Wed Feb  3 08:49:37 1999   
printf( "%3s %3s %2d %02d:%02d:%02d %04d\n", $shortdays[$wday],
    $shortmonths[$mon], $mday, $hr, $min, $sec, $longyr );

# 03/Feb/1999 11:51:57 CST
printf( "%02d/%3s/%04d %02d:%02d:%02d $tz\n", $mday, $shortmonths[$mon],
    $longyr, $hr, $min, $sec );

# Wednesday, February 2, 1999
print "$days[$wday], $months[$mon] $mday, $longyr\n";
print "</pre>\n";

print end_html;