PHP日期转换

时间:2010-12-09 21:37:21

标签: php date time

  

可能重复:
  Format mysql datetime with php

如何转换以下内容:

2010-12-07 12:00:00

进入:

December, 7th, 2010

5 个答案:

答案 0 :(得分:10)

echo date("F, jS, Y", strtotime("2010-12-07 12:00:00"));

http://php.net/manual/en/function.date.php

答案 1 :(得分:4)

查看date功能。

$myDate = strtotime('2010-12-07 12:00:00');
$formattedDate = date('F, jS, Y', $myDate)

答案 2 :(得分:3)

使用date_format

http://www.php.net/manual/en/function.date-format.php

$date = date_create('2010-12-07 12:00:00');
echo date_format($date, 'F, jS, Y');

答案 3 :(得分:3)

echo date('F, jS, Y',strtotime('2010-12-07 12:00:00'));

答案 4 :(得分:3)

$d = strtotime('2010-12-07 12:00:00');
echo date('F, jS, Y', $d);