On Mar 20, rory oconnor said: >On Wed, 2002-03-20 at 22:30, Jeff 'japhy' Pinyan wrote: >> On Mar 20, rory oconnor said: >> >> >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 >> >> I suggest the standard Time::Local module. It's timelocal() function, >> along with the builtin localtime() function, allow you do to virtually >> anything. >> >> use Time::Local; >> use constant SECONDS_PER_DAY => 86400; >> >> my ($year, $mon, $day) = (2002, 3, 20); # today's date >> my $today_at_noon = timelocal(0,0,12, $day, $mon-1, $year-1900); > >One quick question...since I want to run this every week, will that part >here you hard-coded today's date need to be changed to be dynamic?
Of course. And you can bypass that step by make those TWO lines into ONE: my $today_at_noon = timelocal(0,0,12, (localtime)[3,4,5]); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]