I'm using Node.js to build my RSS file. I create a Date string with (new Date).toString()
and then use that value for the <pubDate>
field in the RSS file. However, when I run the Feed Validator, it reports that such a date string is not valid:
An example Date string that I generate is:
Fri Oct 25 2013 17:59:42 GMT+0200 (Central European Daylight Time)
If I understand correctly, in order to validate, there should be a comma after "Fri", and the "GMT" and the parens at the end should be removed. Is there an built-in way to produce such compliant strings with JavaScript or will I have to write a custom function to do this?
I'm using Node.js to build my RSS file. I create a Date string with (new Date).toString()
and then use that value for the <pubDate>
field in the RSS file. However, when I run the Feed Validator, it reports that such a date string is not valid:
An example Date string that I generate is:
Fri Oct 25 2013 17:59:42 GMT+0200 (Central European Daylight Time)
If I understand correctly, in order to validate, there should be a comma after "Fri", and the "GMT" and the parens at the end should be removed. Is there an built-in way to produce such compliant strings with JavaScript or will I have to write a custom function to do this?
Share Improve this question asked Oct 26, 2013 at 14:26 Šime VidasŠime Vidas 186k65 gold badges286 silver badges391 bronze badges1 Answer
Reset to default 21(new Date).toUTCString()
Documented at http://mdn.io/toUTCString