I'm currently pulling a RSS feed which has these dates:
<rss>
<channel>
<lastBuildDate>Thu, 18 Apr 2013 16:14:15 GMT</lastBuildDate>
and
<item>
<pubDate>Fri, 05 Apr 2013 14:25:13 GMT</pubDate>
</item>
<item>
<pubDate>Wed, 05 Sep 2012 10:01:27 GMT</pubDate>
</item>
I am trying to work out the difference between the lastBuildDate and pubdate in days for every item.
So far I have this:
<?php
foreach($rss->channel->item as $item){
$rss->channel->lastBuildDate = date('D, d M Y H:i:s GMT', strtotime($date1));
$item->pubDate = date('D, d M Y H:i:s GMT', strtotime($date2));
$dateDiff = $date1 - $date2;
$fullDays = floor($dateDiff/(60*60*24));
echo "Differernce is $fullDays days";
?>
Unfortunately each item is coming up with a 0 day difference. I know that $date1 and $date2 do not have a reference to the RSS feed, but considering the first half of the line does, does this still require a RSS path? Or am I pulling the RSS feed dates completely wrong in the first place?
Thanks in advance!