http://qs321.pair.com?node_id=146755

From an answer I just posted in alt.perl. How to get the day of the week for a given date, both as a number, and as an abbreviation. Works for 1970 to 2038.
use Time::Local; my ($year, $month, $day) = qw(2002 02 21); my $gmtime = timegm(0,0,0,$day,$month-1,$year-1900); my @gmtime = gmtime($gmtime); # convert back print "day of week is $gmtime[6]\n"; # sunday = 0, saturday = 6 my ($day_of_week) = gmtime($gmtime) =~ /^(\S+)/; # fetch first wor +d print "day of week is $day_of_week\n"; # "Sun" .. "Sat"