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]
> ($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)
> =)

How about:

printf ('Submitted:  %02d/%02d/%02d  %02d:%02d:%02d', $month,
  $mday, $year%100, $hour, $min, $sec);

          ^^^^^^
-- 

Stephen Montgomery-Smith              EMAIL:PROTECTED
307 Math Science Building             EMAIL:PROTECTED
Department of Mathematics             EMAIL:PROTECTED
University of Missouri-Columbia
Columbia, MO 65211
USA

Phone (573) 882 4540
Fax   (573) 882 1869

http://www.math.missouri.edu/~stephen