我想在php中使用以下格式返回日期的函数
2017-01-25T08:55:40.000Z
我试过了
$obj->format(DateTime::ATOM); // output-> 2017-01-25T00:00:00+0100
$obj->format(DateTime::ISO8601); // output-> 2017-01-25T00:00:00+0100
我在PHP中没有得到任何解决方案 - 我可以使用moment.js在javascript中获取此格式,但不能在PHP中获取。
答案 0 :(得分:1)
只需使用此代码::
echo date(DATE_ISO8601, strtotime('2017-01-25 14:40:46'));