Tom Phoenix wrote: > On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: > >> I'm running this as a cron job 1 minute after midnight on Saturday >> nights (Sunday morning) so as to cover all of Saturday back through the >> previous Sunday. Does your suggestion mean I'd have to run it late >> Sunday night in order for it to cover Saturday back to the previous >> Sunday (since the timestamp would be 24 hours ago)? > > The idea is to run it sometime in the first hour (or so) of the day on > Sunday. (Lots of cron tasks get scheduled for that first minute of the > day or week; it's probably more reliable to run it a few minutes > later.) When it runs, it needs to determine the previous day's date > (right?). It can do that by giving localtime an adjusted time value, > instead of the current time. > >> I'm also guessing that this corrects the problem I mentioned regarding >> skipping the 31st of Jan which was in the middle of the week. Is that a >> good assumption? > > Well, that problem came from your own date-handling code (yes?); if > you use Perl's code (i.e., the localtime function), you shouldn't have > those kinds of bugs. Unless I've misunderstood you. > > Good luck with it! > > --Tom Phoenix > Stonehenge Perl Training >
Sorry to rehash this but from this: #!/usr/bin/perl use warnings; use strict; my @date = (localtime (time - (24*60*60)))[3..5]; foreach my $i (@date) { print $i . "\n"; } exit; I get this: 10 1 107 I still have to add 1 to the month. Is that right? Also, the year still needs to be fixed by adding 1900 but from what I've read that is due to the way computers work and not necessarily because of Perl. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/