in reply to Re^2: Converting 24 hour time back into 12 hour
in thread Converting 24 hour time back into 12 hour

one more correction - you have forgot to convert 24hr's 00 hours to 12AM
sub to12h { local $_=shift; if (($_ < 0) || ($_ > 23)) { return ("$_ is not a valid hour"); } return (12, "AM") if $_ == 0; return ($_, "AM") if $_ < 12; return ($_, "PM") if $_ == 12; return ($_ -12, "PM"); } for (0..23) { print join " ", to12h($_), "\n"; }

Replies are listed 'Best First'.
Re^4: Converting 24 hour time back into 12 hour
by Anonymous Monk on Nov 04, 2015 at 03:32 UTC
    there is no such thing as 24:00hrs...