#!/usr/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use Date::Calc qw(:all); use Date::Format; use strict; print header; my($sec ,$min,$hr,$mday,$month,$year,$dayofweek,$dayofyear,$isdst) = localtime(time); $year += 1900; # add 1900 to the year $month += 1; # add 1 to the month (so its 1-12 instead of 0-11) if (leap_year($year)) { print "This is a leap year! "; } my $now = time2str("%B %e",time); my $days_til_xmas = Delta_Days($year,$month, $mday, $year, 12, 25); if ($days_til_xmas < 0) { my $days_ago = $days_til_xmas * -1; print "Today is $now. Christmas was $days_ago days ago. Happy New Year!\n"; } elsif ($days_til_xmas == 0) { print "Today is $now. Merry Christmas!\n"; } else { my $then = time2str("%B %e", time + (86400 * $days_til_xmas)); print "Today is $now. Christmas is $then. Only $days_til_xmas days left!\n"; } print end_html;