Jump to content

[SOLVED] PHP Time - Display 20:30:00 as 8.30pm


mattl

Recommended Posts

Hi,

I've a table column called 'time' in mySQL TIME ie HH:MM:SS. I want to display the value in the format h:mm am/pm (20:00:00 becomes 8:30pm).

 

Each value is returned through $row_events['time']

 

I don't really want to modify the mySQL query, so I've tried the following, but to no avail:

 

Code:

<?php

echo time('%h:%i %p', ($row_events['time']));

?>

 

My brain has stopped working! Any suggestions on the above greatly appreciated.

 

Thanks

Matt

Link to comment
https://forums.phpfreaks.com/topic/99879-solved-php-time-display-203000-as-830pm/
Share on other sites

Archived

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

×
×
  • Create New...

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.