note 36664 modified in function.date by kennyt
| From: | kennyt@php.net | Date: | Sun, 18 Jul 2004 17:33:33 +0000 |
| Subject: | note 36664 modified in function.date by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73522@lists.php.net to get a copy of this message | ||
To convert from day/month/year to year/month/day (as for MySQL), try this one-liner:
<?php $date_mysql = implode( '-', array_reverse( explode( '/',
'20/10/2003' ) ) ); ?>
I hope it helps!
--was--
If you are heating your head looking a way to convert day/month/year to year-month-day, without to
write lines and lines of code to convert, this line will solve your problem.
$date_in_mysql_format =
implode('-',array_reverse(split('[/]','20/10/2003')));
I hope it help!
http://php.net/manual/en/function.date.php