Hola,
Lo que pasa es que la función "date()" requiere como segundo parámetro una "marca de tiempo" (un "timestamp") y no le vale con la fecha en el formato en que la guarda MySQL, en este caso. Aquí te dejo un par de métodos de cierta clase "DateUtils", que, tal vez puedas aprovechar:
Código PHP:
/**
* Decode a datetime MySQL format into an Array.
*
* This method decode a datetime in MySQL format into an
* Array that contain all Year, Month, Day, Hour, Minutes
* and Seconds in their fields.
*
* @static
* @access public
* @param $mysqlDatetime String datetime value in MySQL format
* @return Array Decoded MySQL datetime
*
*/
public static function DecodeMySQLDateTime($mysqlDatetime){
return array(
'year' => (int)substr($mysqlDatetime, 0, 4),
'month' => (int)substr($mysqlDatetime, 5, 2),
'day' => (int)substr($mysqlDatetime, 8, 2),
'hour' => (int)substr($mysqlDatetime, 11, 2),
'minutes' => (int)substr($mysqlDatetime, 14, 2),
'seconds' => (int)substr($mysqlDatetime, 17, 2)
);
}
/**
* Get the UNIX timestamp representation of a MySQL datetime.
*
* This method convert a MySQL date time in the UNIX timestamp.
*
* @static
* @access public
* @param $mySqlDatetime String MySQL datatime to be converted
* @return Integer UNIX timestamp representation of MySQL the datatime
*
*/
public static function MySQLDatetimeToTimestamp($mySqlDatetime){
$d = self::DecodeMySQLDateTime($mySqlDatetime);
if(is_array($d)){
return mktime($d['hour'], $d['minutes'], $d['seconds'],
$d['month'], $d['day'], $d['year']);
}else{
return 0;
}
}
Una vez tengas el "timestamp" ya sí puedes usar la función "date()".