Re: uk date to mysql date and back again
| From: | Stut | Date: | Tue, 10 Apr 2007 15:06:37 +0000 |
| Subject: | Re: uk date to mysql date and back again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252426@lists.php.net to get a copy of this message | ||
Ross wrote:
I have made a very messy function for this that splits the string up does all kinds of stuff but I was wondering if anyone has a 1 or 2 line function for gettting a uk date dd/mm/yyyy (it is a string)to mysql version YYYY-MM-DD and then back again.Assuming you can guarantee that format... $indate = '10/04/2007'; $outdate = implode('-', array_reverse(explode('/', $indate))); And back... $indate = '2007-04-10'; $outdate = implode('/', array_reverse(explode('-', $indate))); -Stut