-4

我在日期时间下面得到了这个字符串。

2013-12-31T00:00:00+01:00

我想将其显示为

2013 年 12 月 31 日凌晨 1 点

请建议我如何使用 php datetime 来实现这一点。

提前致谢。

4

2 回答 2

3
$dt = new DateTime('2013-12-31T00:00:00+01:00');
echo $dt->format('d/m/Y Ha');

FYI, I voted your question down for showing no effort. This actually is easy to figure out from the docs.

于 2013-09-05T18:49:39.310 回答
0
$old_date = '2013-12-31T00:00:00+01:00';
$new_date = date('d/m/Y Ha',strtotime($old_date));
echo $new_date;

这使用了 Date 将日期从一种格式转换为另一种格式的能力

于 2013-09-05T18:52:24.220 回答