Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Outputting RFC 822 Compliant Date for RSS Feed

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

5+ Year Member

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?

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

WebmasterWorld Senior Member 5+ Year Member

Have you tried date('r')? 'r' tells date() to output an RFC2822 formatted date.
8:54 am on Feb 19, 2008 (gmt 0)

5+ Year Member

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?

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

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

will date_default_timezone_set [php.net] do it for you?
5:24 pm on Feb 19, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

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

Featured Threads

Hot Threads This Week

Hot Threads This Month