Clfc Developer
Clfc Developer

Reputation: 15

Mysql date appear as words in php

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

Answers (2)

juergen d
juergen d

Reputation: 204746

select date_format(Date_Hired, '%M %d %Y') from registration

MySQL DATE_FORMAT

Upvotes: 2

Andy Lester
Andy Lester

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

Related Questions