如何将PHP日期转换为ISO 8601格式? [重复]

This question already has an answer here:

I want a function in php that will return a date in following format

2017-01-25T08:55:40.000Z

I tried following

$obj->format(DateTime::ATOM); // output-> 2017-01-25T00:00:00+0100
$obj->format(DateTime::ISO8601); // output-> 2017-01-25T00:00:00+0100

I am not getting any solution for this in PHP - I am able to get this format in javascript using moment.js but not in PHP.

</div>

Just use this code::

echo date(DATE_ISO8601, strtotime('2017-01-25 14:40:46'));