use strict; use warnings; my $xcltime = "00:45:34"; # It should print 12:45 AM my ($h, $m) = split /:/, $xcltime; my $ampm = $h < 12 ? 'AM' : 'PM'; $h = ($h % 12) || 12; print "$h:$m $ampm"; # prints 12:45 AM
In reply to Re: Time transformation
by Arunbear
in thread Time transformation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |