有一个字符串:
$time = "2013-07-10T21:00:00.000";
如何将其转换为“2013-07-10 21:00:00”格式?
答案 0 :(得分:4)
$time = strtotime("2013-07-10T21:00:00.000");
return strftime("%Y-%m-%d %H:%M:%S", $time);
答案 1 :(得分:1)
$date = new \DateTime($time);
$date->format('Y-m-d H:i:s');
答案 2 :(得分:1)
$time = "2013-07-10T21:00:00.000";
echo date("Y-i-d H:m:s",strtotime($time));