How about this. I'd rather look for some module to do it, though...
my @times = qw(7:45:34 19:45:34 23:34:14); foreach my $t (@times) { if ($t =~ /^(\d?\d):(\d?\d):\d?\d$/) { my $ampm = "AM"; my ($h, $m) = ($1, $2); if ($h > 12) { $h -= 12; $ampm = "PM"; } print "$h:$m $ampm\n"; } }
In reply to Re: Time transformation
by lestrrat
in thread Time transformation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |