LPM: Happy ...
Mike Andrews
mandrews at bit0.com
Sat Jan 1 16:58:29 CST 2000
Yup, that's how I do it too, either $year % 100 or $year + 1900.
Apparently a few CGI scripts out there in the world were printing
"19100" for the year today. Heh.
Mike Andrews (MA12) * mandrews at dcr.net * http://www.bit0.com/
VP, sysadmin, & network guy, Digital Crescent Inc, Frankfort KY
Internet services for Frankfort, Lawrenceburg, Owenton, & Shelbyville
"It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear."
On Sat, 1 Jan 2000, Gregg Casillo wrote:
> 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