Question

I'm creating a RSS feed with PHP and I set the date using PHP's build in DATE_RFC822 format:

<lastBuildDate>' . date(DATE_RFC822, strtotime($posts['date'])) . '</lastBuildDate>

Which results in this:

<lastBuildDate>Tue, 01 Oct 13 10:10:00 +0200</lastBuildDate>

When I now try to validate it, it passes, but with the following recommendation:

Problematical RFC 822 date-time value: Tue, 01 Oct 13 10:10:00 +0200

Which has some further information on this page: Problematical RFC 822 date-time value:

The value specified must meet the Date and Time specifications as defined by RFC822, with the exception that the year SHOULD be expressed as four digits.

How can I update the year to a four digit value?

Was it helpful?

Solution

There also exists the DATE_RSS constant: http://php.net/manual/en/class.datetime.php#datetime.constants.rss which is of the expected format:

D, d M Y H:i:s O

So just use date(DATE_RSS, ...).

OTHER TIPS

Use DATE_RSS instead that contains it exactly

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top