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