$mon is the month itself, in the range 0..11 with 0 indicating January and 11 indicating DecemberSo 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
_________
broquaint
In reply to Re: Weird Time: localtime shows wrong month
by broquaint
in thread Weird Time: localtime shows wrong month
by jfroebe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |