0

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.

Tom
  • 4,257
  • 6
  • 33
  • 49
deepak
  • 13
  • 4
  • 10

1 Answers1

1

Just use this code::

echo date(DATE_ISO8601, strtotime('2017-01-25 14:40:46'));
Rana Ghosh
  • 4,514
  • 5
  • 23
  • 40