Vladymyr Hrychenko
Vladymyr Hrychenko

Reputation: 101

RSS feed validation in PHP

I have RSS feed on my site. I have validated it by W3C validator and got a strange result.

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
line 13, column 45: Problematical RFC 822 date-time value: Fri, 08 Sep 17 14:05:57 +0000 

I would fix this recommendation. I'm generating date like date(DATE_RFC822) in PHP. What can be a problem?

I have tried different ways like date('D, d M Y H:i:s +0000'), date('r') etc.

Upvotes: 2

Views: 236

Answers (1)

RToyo
RToyo

Reputation: 2877

The problem that the validator is complaining about, is that that DATE_RFC822 only outputs the last two digits of the year.

PHP has the constant DATE_RSS built in, which you could use instead.

print date(DATE_RSS)

Outputs:

Fri, 08 Sep 2017 16:23:05 +0200

Upvotes: 1

Related Questions