I'm getting dates from feed in this format:
2009-11-04T19:55:41Z
I'm trying to format it using the date()
function in PHP, but I get an error saying:
date() expects parameter 2 to be long, object given in /bla/bla.php
I tried using preg_replace()
to remove the T
and the Z
, but still can't get it to work.
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'));