phpretard Posted February 14, 2008 Share Posted February 14, 2008 The datbase id set to default like this 0000-00-00. I would like to display the date like this 02-14-08. The code below doesn't work (I am sure this is obvious to someone). $date= $row['date']; $date1=date_format($date, '%m %d %y'); echo $date1 ; Please help me... -Anthony Link to comment https://forums.phpfreaks.com/topic/91107-i-need-a-date/ Share on other sites More sharing options...
Daniel0 Posted February 14, 2008 Share Posted February 14, 2008 SELECT DATE_FORMAT(date, '%m-%d-%y') AS formatted_date FROM table; See: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format Link to comment https://forums.phpfreaks.com/topic/91107-i-need-a-date/#findComment-466933 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.