Tim Wolak wrote: > Just a quick easy one, while printing localtime, how do I get it to > print the full minutes and seconds, i.e. :02?? > > Thanks, > Tim > > my $date; > my ($sec,$min,$hour,$mday,$mon,$year) = (localtime) [0,1,2,3,4,5]; > $year=$year+1900; > $mon=$mon+1; > $date = sprintf("%02d%02d%02d\_$hour\:$min\:$sec", $year,$mon,$mday);
my ( $sec, $min, $hour, $mday, $mon, $year ) = localtime; my $date = sprintf '%02d%02d%02d_%02d:%02d:%02d', $year + 1900, $mon + 1, $mday, $hour, $min, $sec; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>