in reply to Weird Time: localtime shows wrong month

Look more closely at the docs with regards to $month
$mon is the month itself, in the range 0..11 with 0 indicating January and 11 indicating December
So your code should look like this
my ($day, $month, $year) = (localtime)[3..5]; $year += 1900; ## increase $month to get desired output $month++; my $date = "$year-$month-$day"; print "$date\n"; $date = localtime; print "$date\n"; __output__ 2004-5-17 Mon May 17 10:41:08 2004
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Weird Time: localtime shows wrong month
by jfroebe (Parson) on May 17, 2004 at 03:48 UTC

    THANKS!

    I knew it was something horribly simple... never get pulled into cleaning the house in the middle of coding.. your brain gets clean slated.

    Jason L. Froebe

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1