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

Re: [MacPerl] Strange time output



martind@algonet.se (Martin D.) wrote:
>
>I ended up using:
>$timestamp = sprintf("%02d-%02d-%02d\n", $year-100, $month+1, $day);


That solution makes me really nervous, it'll break at the slightest
perturbation.  Use this instead:

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

Or even better, use a 4-digit year, which would get you out of this whole mess.

  $timestamp = sprintf("%04d-%02d-%02d\n", $year+1900, $month+1, $day);




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