MLUG: RE: [UUG/MLUG] perl and y2k
RE: [UUG/MLUG] perl and y2k
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
After you get the year from localtime(time) put:

 $year += 1900;

Now this will give you 2000 instead of just 00, but it's a quick fix.  To
get just the 00 you'd just have to do a little math (and probably pre-pend a
0).

Byron

-----Original Message-----
From: Routier, Daniel J. [mailto:EMAIL:PROTECTED]
Sent: Wednesday, January 05, 2000 8:20 AM
To: EMAIL:PROTECTED
Subject: [UUG/MLUG] perl and y2k


Okie so I figure this has been well known and i've missed the talk on it,
but:

($sec,$min,$hour,$mday,$month,$year,$yday,$isdst) = localtime(time);
$month = $month+1;
printf ('Submitted:  %02d/%02d/%02d  %02d:%02d:%02d', $month,
  $mday, $year, $hour, $min, $sec);  

Prints:
=====
Submitted:  01/05/100  08:15:18

So is there a commonly known solution to make localtime spit out 00 or
something that is a little
more accurate than 100 (?)  I've seen this on several sites (including mine)
=)

Daniel J Routier
Programmer / Analyst
Student Financial Aid
University of Missouri