Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Convertendo o formato de data em PHP


Use strtotime() e date():
$originalDate = "Mon Apr 22 2013 12:16:00 GMT+0530 (India Standard Time)" ;
$newDate = date("Y-m-d H:i:s", strtotime($originalDate));

(veja strtotime e data docs no site PHP).

ou use DateTime:
<?php
$source = "Mon Apr 22 2013 12:16:00 GMT+0530 (India Standard Time)";
$date = new DateTime($source);
echo $date->format("Y-m-d H:i:s"); // 22 2013 12:16:00
echo $date->format("Y-m-d H:i:s"); // 22 2013 12:16:00
?>

DEMO