note 19755 added to function.substr
| From: | joemamacow at hotmail dot com | Date: | Sun, 10 Mar 2002 05:13:38 +0000 |
| Subject: | note 19755 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27568@lists.php.net to get a copy of this message | ||
If you get a connection to a database and need to get a date from a mySQL DB in DATE format, then do
like the following:
(Assume that $date is the date from your mySQL DB)
// Standard mySQL Date format - YYYY-MM-DD
// What we want: DD-MM-YYYY
$year = substr($date, 0, 4);
$month = substr($date, 5, 7);
$day = substr($date, 8, 10);
$newdate = "$day-$month-$year";
echo $newdate;
--
http://www.php.net/manual/en/function.substr.php
http://master.php.net/manage/user-notes.php?action=edit+19755
http://master.php.net/manage/user-notes.php?action=delete+19755
http://master.php.net/manage/user-notes.php?action=reject+19755