Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Converting 24 hour time back into 12 hour

by TedPride (Priest)
on Nov 08, 2004 at 05:24 UTC ( [id://405975]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(t
    +ime);
    my $shour = ($hour > 11 ? $hour - 12 : $hour);
    $shour = 12 if ! $shour; # if 0 should be 12
    
  2. or download this
    my $hour = int (time / 3600) % 12;
    $hour = 12 if ! $hour; # if 0 should be 12
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-23 09:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found