Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 ( #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? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2021-10-16 17:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (69 votes). Check out past polls.

    Notices?