Forum Moderators: coopster

Message Too Old, No Replies

Formating Date

         

Gian04

8:06 am on Jul 18, 2007 (gmt 0)

10+ Year Member



I know how to get, format and display the current date but what I cant do is to format and display a date that has been retrieved from mySQL DB. Example 2007-07-18 (YYYY-MM-DD) How will I format it to display July 18, 2007?

dreamcatcher

8:21 am on Jul 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Gian04,

DATE_FORMAT [dev.mysql.com] will be what you are looking for

mysql_query("SELECT DATE_FORMAT(date,'%M %d, %Y') AS new_date...

with the date in the format being your date field name.

dc

Habtom

8:24 am on Jul 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$new = strtotime("2007-07-18");
echo date("F j, Y", $new);

Hab