What is the correct format for RSS feed pubdate?

Dan Fein picture Dan Fein · Aug 16, 2012 · Viewed 71k times · Source

I'm having trouble getting the date of my RSS Feed to run correctly. Do you know what the proper date to show it is?

I have it stored in a field called creation_date in this format: 2012-08-14 10:17:12

Then i grab it:

$pubDate = $article[creation_date];

Then I convert it:

$pubDate= date("Y-m-d", strtotime($pubDate));

Then within my item tag I place it:

<pubdate>'.date("l, F d, Y", strtotime($pubDate)).'</pubdate>

Is there something that I'm not seeing?

Answer

Nebel54 picture Nebel54 · Jul 29, 2014

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

date('r', $timestamp);