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);
Either my @date = reverse ((localtime)[0 .. 5]); $date[0] += 1900; $date[1]++; my $date = sprintf "%d%02d%02d_%02d:%02d:%02d", @date; or use POSIX qw/strftime/; my $date = strftime '%Y%m%d_%H:%M:%S', localtime; Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
