Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my($day, $month, $year)=(localtime)[3,4,5]; print "$day\-".$month+1."-".$year+1900."\n";
does this always work. I know it works right now, but how does it work when it gets to December. Is the value 11 and you increment one, and then the next month is 00. I am just a little confused and timid to place this in my code. Does it also work the same for the day if you +1?
thanks for any help you give
Edit Masem 2001-10-15 - CODE and P tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: date and time
by suaveant (Parson) on Oct 16, 2001 at 00:11 UTC | |
by arabella (Acolyte) on Oct 16, 2001 at 06:57 UTC | |
|
Re: date and time
by blakem (Monsignor) on Oct 16, 2001 at 00:07 UTC | |
|
Re: date and time
by artist (Parson) on Oct 16, 2001 at 00:21 UTC | |
|
Re: date and time
by fokat (Deacon) on Oct 16, 2001 at 01:35 UTC | |
|
Re: date and time
by mitd (Curate) on Oct 16, 2001 at 06:39 UTC | |
|
Re: date and time
by pixel (Scribe) on Oct 16, 2001 at 12:03 UTC | |
|
Re: date and time
by Stegalex (Chaplain) on Oct 16, 2001 at 07:57 UTC | |
by belden (Friar) on Oct 16, 2001 at 08:33 UTC |