[thelist] PHP/MySQL Date Format Help

Rob Smith rob.smith at THERMON.com
Wed Aug 4 08:28:08 CDT 2004


Hi,

I had a problem last night that I thought you could help me with. If you've
ever worked with php/mysql and the date format, you've probably seen the
format like YYYY-MM-DD. 

In this particular case, my date is 2004-08-01 (Last Sunday) that was
entered by the "admin" for the purposes of placing into the mySQL database
accurately. 

I want to transform this date into a "readable" format for the end user.
That this is ultimately going to go to. When I try to spit this back out
through PHP by date formatting it " . date("M d y", $_POST["orderdate"]) .
", It always returns the day before the day Delphi Time began, 1/1/1970,
which is Dec 31 1969. 

Can anyone offer a more cleaver way to reformat the YYYY-MM-DD into
DD-MM-YYYY. Strangely enough I think I see the answer:

$date = split("",$_POST["orderdate"]);
$date = array_flip($date);

Anything better?

Rob Smith


More information about the thelist mailing list