0
votes

I've been validating my RSS feed at http://validator.w3.org/feed/check.cgi it gives me the warning:

In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendation.

line 10, column 46: Problematical RFC 822 date-time value: Mon, 15 Dec 14 15:26:54 +0000 

            <pubDate>Mon, 15 Dec 14 15:26:54 +0000</pubDate>

I generate the date with php and wordpress

      date(DATE_RFC822, strtotime(get_post_time('Y-m-d H:i:s',$postid));

The date is definite formatted as DFC822, as i'm using PHPs built in RFC822 definition what is the validator complaining about, and how to i fix it.

2
why bother with strtotime and date? get_post_time is already using date() internally, so why not just get_post_time('r', $postid)? You're just forcing php to do a hell of a lot of useless work with timestamp->string->timestamp->string. - Marc B

2 Answers

0
votes

Turns out the W3C Validator wants dates with four digit years not two digit years, so the right date is:

 date("D, d M Y H:i:s O",get_post_time($postid))
0
votes

You could use a much simpler get_the_time('r', $postid).

  • get_the_time will get the post's published time
  • the r argument will automatically format the date as RFC 2822

As far as I can see, there's no reason to get the post time, parse to timestamp and then format it again.

Hope this helps.