how to format atom date time
strtotime
is a wonderful function for converting date formats to Unix timestamps.
This will give you what you're after:
date('my format here', strtotime('2009-11-04T19:55:41Z'));
What about
\DateTime::createFromFormat(\DateTime::ATOM, $AtomDate); // converting Atom date to object
or
date(\DateTime::ATOM, $timestamp); // formatting timestamp to Atom time
or both
$dto = \DateTime::createFromFormat(\DateTime::ATOM, $AtomDate);
date('d-M-Y H:i:s', $dto->getTimestamp()); // formatting Atom date to anything you want
or even better
$dto = \DateTime::createFromFormat(\DateTime::ATOM, $AtomDate);
$formattedDate = $dto->format('d-M-Y H:i:s');
or with time zone (as mentioned in comments)
$dto = \DateTime::createFromFormat(
\DateTime::ATOM,
$ticketUpdatedAt,
new \DateTimeZone('UTC')
);
$ticketUpdatedDate = $dto->format('Y-m-d H:i:s');
Try using strptime
:
$date = strptime($str, "Y-m-d\TH:i:s\Z");