Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I convert localtime to display 12 hr time instead of 24 hr time

by eighty-one (Curate)
on Nov 14, 2008 at 04:09 UTC ( [id://723555]=note: print w/replies, xml ) Need Help??


in reply to How do I convert localtime to display 12 hr time instead of 24 hr time

Or
$ampm = ( $hour < 12 ? 'am' : 'pm' ); if($hour > 12){ $hour -=12; }

(I would have overlooked the am/pm requirement if someone hadn't gotten here first . . . Thanks ikegami ;)

Whenever I have a time question I usually go to The many dates and times of Perl but I didn't see anything applicable there. Of course, I'm sleepy and very well may have overlooked something.

  • Comment on Re: How do I convert localtime to display 12 hr time instead of 24 hr time
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-16 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found