note 23463 added to function.date

From: Date: Thu, 18 Jul 2002 23:35:53 +0000
Subject: note 23463 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-33278@lists.php.net to get a copy of this message
Ok, I am adding this because for some strange reason, PHP would not allow me to use the DATE_FORMAT function in the mysql query to format the date. It was null. I am very new to this, and this is the only way I could figure out how to convert a simple 'date' type from MYSQL to a more US user friendly date. It's probably just our config though. $query="SELECT something, date FROM table where name='$name'"; $date=mysql_query($query, $connection); while ($usedate=mysql_fetch_array($date, MYSQL_ASSOC)) { extract ($usedate, EXTR_PREFIX_ALL, "d"); $year=substr($d_date,0,4); $month=substr($d_date,5,2); $day=substr($d_date,8,2); echo "$name, $month-$day-$year"; } -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+23463 http://master.php.net/manage/user-notes.php?action=delete+23463 http://master.php.net/manage/user-notes.php?action=reject+23463

« previous php.notes (#33278) next »