Atom XML timestamp to PHP Date Time Object
I often need to read and format the updated node in an Atom formatted XML feed for display. PHP oddly lacks the ability to make a date object from RFC 3339 formatted dates, so here’s how to do it in PHP:
< ?php
$atomFormattedDate = '1984-01-24T12:00:00.000Z';
$phpTimestamp = strtotime(substr($atomFormattedDate, 0, 10).' '.substr($atomFormattedDate, 11, 8));
echo date('m d, y', $phpTimestamp);
?>
Posted on Monday, May 4th, 2009 at 11:35.