Jump to content


Formatting time for display

  • Please log in to reply
1 reply to this topic

#1 skallsen

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 27 April 2006 - 06:16 AM

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?


#2 ober

  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 27 April 2006 - 12:31 PM

date("h:i A", strtotime($record['date_column']))

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

Info: PHP Manual

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users