Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
hi,
I have this following code that produces today's date in the following format YYYY-MM-DD
however, this code prints today's date as: 2006-4-9 and NOT 2006-04-09
what can I do to my script so that the date has 0's?
I have this following code that produces today's date in the following format YYYY-MM-DD
however, this code prints today's date as: 2006-4-9 and NOT 2006-04-09
what can I do to my script so that the date has 0's?
thanks!my $time = time; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yd +ay,$isdst) = localtime($time); $mon++; $year += 1900; my $date = "$year-$mon-$mday";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Date displaying the 0's
by borisz (Canon) on Apr 09, 2006 at 19:02 UTC | |
Re: Date displaying the 0's
by graff (Chancellor) on Apr 10, 2006 at 00:10 UTC | |
Re: Date displaying the 0's
by eXile (Priest) on Apr 10, 2006 at 00:42 UTC | |
Re: Date displaying the 0's
by jwkrahn (Abbot) on Apr 10, 2006 at 02:40 UTC | |
Re: Date displaying the 0's
by sen (Hermit) on Apr 10, 2006 at 04:29 UTC |
Back to
Seekers of Perl Wisdom