I am trying to format a date from an RSS feed using the following code:
foreach ($xml->channel->item as $item) {
$originalDate = trim($item->pubDate);
$newDate = date("d-m-Y", strtotime($originalDate));
var_dump($newDate);
}
The format of the date is Fri, 03 Aug 2012 13:08:11 UT which comes from $item->pubDate. Unfortunately this code does not work and the result are "31-12-1969" How do I get the proper date?
Since you don’t seem to need the time anyways, and just the date, this works for me:
PHP doesn’t seem to recognize the UT part.