You can use probably a number of different modules, but just some simple Perl processing can do the work for you:
use Time::Local; # # Put date here, need to subtract one from Month for use in timelocal # Can leave year at 4 digits or take down to 3 digits(ie, 1900 from 4 digit) # my $DD = 20; my $MM = 2; # subtract 1 from month my $YYYY = 2002; my @MyDay = qw(dum Sun Mon Tue Wed Thu Fri Sat); my $MyDate = timelocal(0,0,12,$DD,$MM,$YYYY); # gives you epoch seconds using noon my @TimeInfo = localtime($MyDate); my $MySunday = $MyDate - ($TimeInfo[6] * 86400); # [6] holds day of week(Sun:0 thru Sat:6) my $MyCurrDay = $MyDay[$TimeInfo[6]]; @TimeInfo = localtime($MySunday); $TimeInfo[4]++; printf "%-3s:%4d-%02d-%02d\n", $MyCurrDay, $YYYY, ($MM+1), $DD; printf "Sun:%4d-%02d-%02d\n", ($TimeInfo[5]+1900), $TimeInfo[4], $TimeInfo[3]; Output: Tue:2002-03-20 Sun:2002-03-17 Wags ;) -----Original Message----- From: rory oconnor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 20:12 To: perl Subject: Finding the date of last sunday Can anyone think of a good way for me to find out what the date of last sunday is with perl? I'm writing a script that will need to do some basic reporting starting from the previous sunday. I'm usign the date format YYYY-MM-DD Any help appreciated! Thanks, rory -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]