Solved

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

Posted on 2012-12-21
2
294 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
2 Comments
 
LVL 12

Accepted Solution

by:
jamesrh earned 500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

831 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