Date and time
Posted: Sat Sep 17, 2005 1:58 pm
I am trying to display the time like this: "1:05 pm". But it seems php can't get the "pm" and the 1 digit hour.
Here is what I got:
%g should get the 1 digit hour and %a the pm or am.
This is what I have in the database:
9/15/2005 5:07:10 PM
This is what I have displayed:
September 15, 2005 g:54 Thu
Here is what I got:
Code: Select all
$query = "SELECT newsid, newsheadline, newscontent, DATE_FORMAT(newsdate, '%M %d, %Y %g:%i %a') AS nd FROM news ORDER BY newsdate DESC";This is what I have in the database:
9/15/2005 5:07:10 PM
This is what I have displayed:
September 15, 2005 g:54 Thu