Reputation: 15
I have a table which contain a date field in a date format (mysql). However, I want the date to appear in words in php. If I want to select those: e.g. 2011-05-15 (mysql), should be displayed as May 15, 2011...
$query = "select Date_Hired from registration where IdNum = '".$IdNum."' ";
I want that Date_Hired will appear in page in words. thank you.
Upvotes: 0
Views: 1215
Reputation: 93636
Look at the MySQL DATE_FORMAT()
function.
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
Examples:
mysql> SELECT DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y');
-> 'Sunday October 2009'
mysql> SELECT DATE_FORMAT('2007-10-04 22:23:00', '%H:%i:%s');
-> '22:23:00'
Upvotes: 0