note 23075 deleted from function.substr by aidan
| From: | aidan@php.net | Date: | Sat, 03 Jul 2004 07:53:44 +0000 |
| Subject: | note 23075 deleted from function.substr by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72386@lists.php.net to get a copy of this message | ||
Note Submitter: bort@thebort.com
----
Hey for those who may be sort of noobies at php I wrote this handy function to change a mysql date
2002-07-09 into 07/09/2000 using a custom php function. To use it just put in :
echo formatmysqldate(<date variable goes here>);
Heres the function and enjoy:
function formatmysqldate($date) {
$year = substr($date, 0, 4);
$month = substr($date, -5, 2);
$day = substr($date, 8, 9);
echo $month;
echo "/";
echo $day;
echo "/";
echo $year;
}