[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Strange time output



#! perl -w

($day, $month, $year) = (localtime) [3,4,5];
$timestamp = sprintf("%02d-%02d-%02d\n", $year, $month+1, $day);

print "$timestamp";

this produces:
100-01-11

Shouldn't it produce:
00-01-11

Can anyone tell me why this happens? $year is formatted to be two digits I
can't see how I suddenly get three... and 100 at that.

thanks,
/Martin



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org