How to parse <pubDate> in RSS

R

Ruby Girl

Hi Experts,

Is there another way to get a valid date from pubDate in RSS like this
example:
<pubDate>Wed, 23 Feb 2005 16:12:56 GMT</pubDate>
...to a format (YYYYMMDD hh:mm:ss) that is recognizable by the parsers?

Ruby Girl
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Sat, 6 Sep 2008 08:53:52 +0900
Von: Ruby Girl <[email protected]>
An: (e-mail address removed)
Betreff: How to parse <pubDate> in RSS
Hi Experts,

Is there another way to get a valid date from pubDate in RSS like this
example:
<pubDate>Wed, 23 Feb 2005 16:12:56 GMT</pubDate>
...to a format (YYYYMMDD hh:mm:ss) that is recognizable by the parsers?

Ruby Girl

Hi Ruby Girl,

if you remove the <pubdate> and the weekday, parsing works:

require "date"
text="<pubDate>Wed, 23 Feb 2005 16:12:56 GMT</pubDate>"
text.gsub!(/<\/*pubDate>/,'')
text.gsub!(/^...,/,'')
p text #text="23 Feb 2005 16:12:56 GMT"
p DateTime.parse(text)

Best regards,

Axel
 
P

Peña, Botp

RnJvbTogUnVieSBHaXJsIFttYWlsdG86cnVieW9uZ2lybEBnbWFpbC5jb21dIA0KIyBJcyB0aGVy
ZSBhbm90aGVyIHdheSB0byBnZXQgYSB2YWxpZCBkYXRlIGZyb20gcHViRGF0ZSBpbiBSU1MgbGlr
ZSB0aGlzDQojIGV4YW1wbGU6DQojICA8cHViRGF0ZT5XZWQsIDIzIEZlYiAyMDA1IDE2OjEyOjU2
IEdNVDwvcHViRGF0ZT4NCiMgLi4udG8gYSBmb3JtYXQgKFlZWVlNTUREIGhoOm1tOnNzKSB0aGF0
IGlzIHJlY29nbml6YWJsZSBieSANCiMgdGhlIHBhcnNlcnM/DQoNCmlmIHlvdSBkb3dubG9hZGVk
IHRoYXQgdXNpbmcgcnVieSByc3MsIHRoYXQgd291bGQgYXV0b21hdGljYWxseSBiZSBwYXJzZWQu
IHBscyBwb3N0IHlvdXIgcnNzIGNvZGUuDQoNCmtpbmQgcmVnYXJkcyAtYm90cA0K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top