Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Converting 24 hour time back into 12 hour

by Kanji (Parson)
on Nov 07, 2004 at 01:20 UTC ( #405834=note: print w/ replies, xml ) Need Help??


in reply to Converting 24 hour time back into 12 hour

$hour %= 12

    --k.



Comment on Re: Converting 24 hour time back into 12 hour
Download Code
Replies are listed 'Best First'.
Re^2: Converting 24 hour time back into 12 hour
by bart (Canon) on Nov 07, 2004 at 06:41 UTC
    To fix it for zero, at 0 and 12 hours:
    ($hour %= 12) ||= 12;
Re^2: Converting 24 hour time back into 12 hour
by pg (Canon) on Nov 07, 2004 at 01:46 UTC

    The problem with your solution is that, now 12:00 (lunch time) becomes 0:00 ;-) If you read other answers carefully, you will fnd that they made effort to avoid this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://405834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2015-07-28 17:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls