in reply to how do i get yesterday's date using localtime()?

localtime takes an argument of the form returned by the time function. e.g epoch seconds. Which is just a number that you can subtract from. So
my $now = time; for my $i (0..9) { print "$i days ago... ", scalar localtime $now - $i * 86400, "\n"; }
should work. 86400 is the number of seconds in a day. You could also do this using Date::Manip.

And you could get fancier w/ the date printout than this is--it's just an example.

Replies are listed 'Best First'.
(dws)Re: Re: how do i get yesterday's date using localtime()?
by dws (Chancellor) on May 30, 2001 at 00:27 UTC
    For a discourse (with code) on why subtracting 86400 is the wrong way to go about this in general (for two one-hour windows each year), see On the peril of discounting intuition.

    The punchline is "daylight savings time".

    If you're working backwards from a time within normal business hours, you should be O.K.

Re: Re: how do i get yesterday's date using localtime()?
by qball (Beadle) on May 30, 2001 at 00:13 UTC
    Using btrott's example, how could you get fancier with the date. Suppose I want to break out the string into just numbers like 052901 instead of May 29, 2001.

    qball~"I have node idea?!"