According to Format manual
public string DateTime::format ( string $format )
Where
$format Format accepted by date().
and if you look at date ()
$d->format(\DateTime::ISO8601);
it should be
$d->format("c")
because "c" matches the format in date ()
Date ISO 8601 (added in PHP 5)
In my test, $d->format(\DateTime::ISO8601); exits
2015-09-15T00: 00: 00 + 0200
while
$d->format("c");
exits
2015-09-15T00: 00: 00 + 02: 00
Hope this helps.
source share