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

Re: [MacPerl] Strange time output



At 14.08 -0500 0-01-11, Ronald J Kimball wrote:
>The documentation can tell you why this happens.  Haven't you read it?
>
>If you want a two-digit year:
>
>$year %= 100;

Yes, I'm guilty of not having read the perlfunc.pod on localtime before
posting *ashamed*. Had I done that I would have noticed that time begins
1900... Regardless of that, I wouldn't have figured why I got three digits
when using sprintf(%02d), not that that's an excuse for not reading up on
localtime before posting but I wish it could be;).

I ended up using:
$timestamp = sprintf("%02d-%02d-%02d\n", $year-100, $month+1, $day);


Anyhow, thanks everyone for your replies!

regards,
/Martin






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