> Hello all. Trying to get a 2 digit readout from $hour pulled from > localtime. How can I do this? > > This is running on a sun box, so I also tried pulling from: > $string = system "date"; but if one digit, it will not put a "0" in front. > > But this doesn't only seems to assign "0". And it prints output > correctly, but not assigning it to my string. > > Ugh, I hope I explained this right. I'm a beginner in the rough. ;->
Here's how I do it: ($sec,$min,$hour,$mday,$mon,$year) = localtime; printf "%02d%02d%02d-%02d%02d%02d)\n", $year % 100, $mon+1, $mday, $hour, $min, $sec; - B