[Updated with working solution] I have an RSS feed which gets displayed correctly in RSS clients, but when being validated by http://feedvalidator.org I get this error:
pubDate must be an RFC-822 date-time
My date is formatted as follows:
Wed, 27 Feb 2013 17:18:15 CET
Any idea what could be wrong? Could it be the timezone?
Thanks to Calum I got a valid RSS feed now. Reason was the CET
not being supported in the pubDate
.
The following Java Code is working now fine:
String pubDate = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z").format(new Date());
The RFC indicates it only supports a very limited set of symbolic timezone names; just UTC and US ones:
zone = "UT" / "GMT" ; Universal Time
; North American : UT
/ "EST" / "EDT" ; Eastern: - 5/ - 4
/ "CST" / "CDT" ; Central: - 6/ - 5
/ "MST" / "MDT" ; Mountain: - 7/ - 6
/ "PST" / "PDT" ; Pacific: - 8/ - 7
/ 1ALPHA ; Military: Z = UT;
; A:-1; (J not used)
; M:-12; N:+1; Y:+12
/ ( ("+" / "-") 4DIGIT ) ; Local differential
; hours+min. (HHMM)
You probably need to specify as an offset to UTC.
Since you say you're using Java, it looks like SimpleDateFormat will give you an RFC-822 compliant date if you use Z
to format the zone in your time format (rather than z
).
You have to use the Z
to format the time zone as Calum said, but don't forget to specify the Locale
too or else it won't work if the computer is not in English...
Here is my working code :
new SimpleDateFormat("E, d MMM yyyy HH:mm:ss Z", Locale.US).format(new Date());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With