View Single Post
Old 01-11-2011, 03:08 AM  
StariaDaniel
Confirmed User
 
Join Date: Oct 2007
Location: Netherlands
Posts: 415
Quote:
Originally Posted by Angry Jew Cat View Post
Code:
$oldDate = "1/12/2011";
list ($day, $month, $year) = explode("/", $oldDate); 
$newDate = "$year-$day-$month";
The code is perfect for what you want to do, except that it's YYYY-MM-DD in mysql, not YYYY-DD-MM ( http://dev.mysql.com/doc/refman/5.1/en/datetime.html )

so it should be

Code:
$oldDate = "1/12/2011";
list ($day, $month, $year) = explode("/", $oldDate); 
$newDate = "$year-$month-$day";
StariaDaniel is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote