Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

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

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.
0
Donnie Walker
Asked:
Donnie Walker
1 Solution
 
jamesrhCommented:
echo date("g:i A", strtotime($row['startTime'])) ." - ". date("g:i A", strtotime($row['endTime'])) ."<br>"
0
 
Donnie WalkerAuthor Commented:
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now