The months returned from localtime are in the range 0..11,
so you need to add +1 to get a human rep. This apparently
weird convention comes from C, and is useful for indexing
months in
0-based arrays in C and Perl. The $wday is 0-based as well.
The year offset is harder
to justify and IIRC this will be corrected in Perl6.
-Mark | [reply] |
Absolutely perfect... that explains everything. Thank you very much Mark !
| [reply] |
Now, when I run the program, I get these results: 14052002 This is exactly one month ago... I run DATE on my linux box, and it gives me the correct date. Any ideas ?
Yes. Re-read the documentation for localtime carefully. You're adding 1900 to the year, so you're close to getting it right.
| [reply] |