What is the correct format for RSS feed pubdate? What is the correct format for RSS feed pubdate? php php

What is the correct format for RSS feed pubdate?


The PHP date function has already a way to format pubDate (RFC 2822) compliant dates:

date('r', $timestamp);


Solved:

$pubDate = $article[creation_date]; $pubDate= date("D, d M Y H:i:s T", strtotime($pubDate));

then in my echo'd code:

 <pubDate>'.$pubDate.'</pubDate>


See pubDate definition in RSS 2.0 Specification:

All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).

Here are examples of valid RFC822 date-times:

<pubDate>Wed, 02 Oct 2002 08:00:00 EST</pubDate><pubDate>Wed, 02 Oct 2002 13:00:00 GMT</pubDate><pubDate>Wed, 02 Oct 2002 15:00:00 +0200</pubDate>

See also Problematical RFC 822 date-time value.