Jump to content


This topic is now archived and is closed to further replies.


Formatting time for display

Recommended Posts

I have this bit of code which displays a date and corresponding start and end times for that date.

if( strlen($record['Day1Date']) != NULL)
echo $record["Day1Date"].": ".[!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--]$record["Day1Start"][!--colorc--][/span][!--/colorc--].$record["Time1Start"]." -".$record["Day1End"].$record["Time1End"]."<br />";

For $record["Day1Start"] I want the time to display hour/min like 4:00. Right now it displays as 04:00:00.

I've read a bunch of information on formatting dates but I'm not understanding how to use it in this case. Can someone show me?


Share this post

Link to post
Share on other sites
date("h:i A", strtotime($record['date_column']))

Look up the date function in the manual for variations of the date formatting.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.