在php中转换日期

时间:2010-10-28 16:43:27

标签: php

如何将“Thu Oct 28 16:33:29 +0000 2010”改为“2010年10月28日下午10:33”

2 个答案:

答案 0 :(得分:7)

strtotime functiondate function

结合使用
echo date("jS F, Y", strtotime("11/25/10"));
// outputs 25th November, 2010 

答案 1 :(得分:1)

$date = DateTime::createFromFormat('Thu Oct 28 16:33:29 +0000 2010', 'D M j h:m:s O Y');
echo $date->format('M d,Y, h:mA');

相关文档here