How do I format these times to the 12hr format?

Donnie Walker
Donnie Walker used Ask the Experts™
on
I have this code:

echo $row['startTime'] ." - ". $row['endTime'] ."<br>";

that returns the start and end time in military format (11:30:00 - 13:30:00).

How do I convert them to 12HR time like this:

11:30 AM - 1:30 PM

Any help would be appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
echo date("g:i A", strtotime($row['startTime'])) ." - ". date("g:i A", strtotime($row['endTime'])) ."<br>"

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial