?
Solved

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

Posted on 2012-12-21
2
Medium Priority
?
299 Views
Last Modified: 2012-12-21
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
Comment
Question by:Donnie Walker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
jamesrh earned 2000 total points
ID: 38714670
echo date("g:i A", strtotime($row['startTime'])) ." - ". date("g:i A", strtotime($row['endTime'])) ."<br>"
0
 

Author Closing Comment

by:Donnie Walker
ID: 38714681
thanks
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question