RSS Feed date/time problems
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 13, 2009 (RSS)
By bruno - November 13, 2009
Hi,
I have created a feed from the blog section of a site running CMS builder. RSS feed seems to be displaying in browsers just fine, but facebook is being picky about validation.
I used a feedvalidator here:
http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fcamusaromance.com%2Fblog%2Frss.xml.php
It sees that in order for the feed to be valid the pubdate needs to be RFC-822 date-time format.
Im currently generating the date time this way: <pubDate><?php echo date("r", strtotime($record['date'])) ?></pubDate>
Any idea how I would generate the time with php in that format?
I have created a feed from the blog section of a site running CMS builder. RSS feed seems to be displaying in browsers just fine, but facebook is being picky about validation.
I used a feedvalidator here:
http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fcamusaromance.com%2Fblog%2Frss.xml.php
It sees that in order for the feed to be valid the pubdate needs to be RFC-822 date-time format.
Im currently generating the date time this way: <pubDate><?php echo date("r", strtotime($record['date'])) ?></pubDate>
Any idea how I would generate the time with php in that format?
Re: [bruno] RSS Feed date/time problems
By Luke - November 13, 2009
Hi bruno,
Thank you for your post.
While you're using the correct code to generate an RFC-822 date it looks like it's outputting the year with only two digits instead of four. This may have something to do with the version of PHP that's installed on your server.
Because of this we'll have to recreate the date using PHP date format characters. An example of RFC-822 dates can be found here http://feedvalidator.org/docs/error/InvalidRFC2822Date.html.
I was able to recreate one using the following code, so try using this for your <pubDate> instead:
<?php echo date("D, d M Y H:i:s O", strtotime($record['date'])) ?>
I hope this helps. Let me know if you have any more questions.
Cheers,
Luke
Thank you for your post.
While you're using the correct code to generate an RFC-822 date it looks like it's outputting the year with only two digits instead of four. This may have something to do with the version of PHP that's installed on your server.
Because of this we'll have to recreate the date using PHP date format characters. An example of RFC-822 dates can be found here http://feedvalidator.org/docs/error/InvalidRFC2822Date.html.
I was able to recreate one using the following code, so try using this for your <pubDate> instead:
<?php echo date("D, d M Y H:i:s O", strtotime($record['date'])) ?>
I hope this helps. Let me know if you have any more questions.
Cheers,
Luke
Luke Holzken
Product Development
Product Development