LPM: Happy ...

Gregg Casillo gcasillo at ket.org
Sat Jan 1 15:59:12 CST 2000


Yeah, we ran into a problem with this today. A schedule we use to
display KET's programming was looking for "jan100" at midnight last
night. Dave Hempy, another Perlmonger and fellow KET hacker came up with
the following solution:

$year = $year % 100;
$year = sprintf("%02d",$year);

If you want to work with the entire four digit year, I guess you'd add
1900 to your year and go from there. But if you've been working with two
digits, this works quite well.

Felice Nuovo Anno,
Gregg Casillo

Rich Bowen wrote:

> > perl -e '@time = localtime; print $time[5], "\n"' ;
> 100
>
> :-)
>
> Rich
> --
> http://www.ApacheUnleashed.com/
> Lexington Perl Mongers - http://lexington.pm.org/
> PGP Key - http://www.rcbowen.com/pgp.txt




More information about the Lexington-pm mailing list