I have date as Fri, 15 Mar 2019 08:56:57 +0000
I want to convert this date in ISO 8601 format in UTC timezone in php.
I have tried the following:
$date = new DateTime("Fri, 15 Mar 2019 08:56:57 +0000");
$output = $date->format(\DateTime::ATOM);
Is this correct?
My Answer:
"Fri, 15 Mar 2019 08:56:57 0000");
$date->setTimezone(new DateTimeZone('UTC'));
$iso8601 = $date->format('c');
echo $iso8601;
Rate this post
4 of 5 based on 3992 votesComments