Re: date conversions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 16 December 2004 14:00, neil wrote:

> I am needing to convert a d/m/y date such as 30/11/2004 into the format
> that mysql can use ie. 2004-11-20
>
> If I try the following:
>
> $testdate="30/11/2004";
> echo date("Y-m-d", strtotime($testdate));
>
> the result is - 2006-06-11
>
> I can't find any other function apart from strtotime to do this.

Use the string functions to manipulate it into the required format, explode() 
is one approach. If you're desperate search the archives, hundreds of 
variations of code to do this have been posted in the past. But it might be 
quicker to write your own than to hit upon the appropriate keywords to search 
for.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
If practice makes perfect, and nobody's perfect, why practice?
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux