homepage Welcome to WebmasterWorld Guest from 54.204.128.190
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Outputting RFC 822 Compliant Date for RSS Feed
itledi




msg:3577920
 3:16 pm on Feb 18, 2008 (gmt 0)

I'm trying to create a RSS feed through a PHP script.

I'm almost done, but I'm having one small problem with my dates.

Using the following code I sometimes get an "Implausible date" error at feedvalidator.org. How can I output a RFC 822 standards complient date?

echo "<pubDate>".date("D, d M Y G:i:s")." GMT</pubDate>";

I'm not sure, but I think my problem is sometimes the time is 00:00:00. Is that not allowed? Is that the problem? Is it fixable?

 

cameraman




msg:3578031
 5:47 pm on Feb 18, 2008 (gmt 0)

Have you tried date('r')? 'r' tells date() to output an RFC2822 formatted date.

itledi




msg:3578608
 8:54 am on Feb 19, 2008 (gmt 0)

Thank you, I didn't realize there was a shorter way to write a RFC date.

I'm still getting the implausible date issue. I'm thinking its not because of date format now, but because of my server location.

I get the problems when its early in the morning. The server is seven hours away from GMT, so I'm getting times like "00:00:00 -0700". Is there a way to convert my time, or shift it, so it reports in GMT time? That way, its not minus seven hours that aren't there?

phranque




msg:3578638
 9:39 am on Feb 19, 2008 (gmt 0)

will date_default_timezone_set [php.net] do it for you?

cameraman




msg:3578957
 5:24 pm on Feb 19, 2008 (gmt 0)

gmdate() [php.net], works same as date() but in GMT.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved