How to convert time from rss feed to another format?

Hi,

I need to parse the rss feed and use the pubDate field to generate a
field in a xml file to use as an input to simile timeline. RSS returns
the pubDate as :

Sun Feb 24 06:33:32 UTC 2008

But I need it as a string :

“Feb 24 2008 06:33:32 PST”

When I do :

@dt=feed_item.time
@[email protected]_date
word_date=’%b %d %Y %H:%M:%S %z’

puts @dt.strftime(word_date)

Then I am getting :

Feb 24 2008 00:00:00 +0000

what am I doing wrong?

Feb 24 2008 00:00:00 +0000

what am I doing wrong?

You’re calling to_date - that discards the time of day part.

Fred

Frederick C. wrote:

Feb 24 2008 00:00:00 +0000

what am I doing wrong?

You’re calling to_date - that discards the time of day part.

Fred

Now the output is

Apr 22 2008 10:09:17 Pacific Standard Time

But I want :

Apr 22 2008 10:09:17 PST

Now what should I do?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs