ParseDate and Time

Hello,

how can I parse a Date from a String into a Time object?

I tried the following but the timezone seems to be ignored:

irb(main):012:0> t = ParseDate.parsedate(“Tue, 16 Jul 2002 21:25:08 +0200”)
[2002, 7, 16, 21, 25, 8, “+0200”, 2]
irb(main):013:0> Time.gm(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,t[7])
Tue Jul 16 21:25:08 UTC 2002
irb(main):014:0> Time.local(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,t[7])
Tue Jul 16 21:25:08 CEST 2002
irb(main):015:0> Time.local(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,"+0300")
Tue Jul 16 21:25:08 CEST 2002
irb(main):016:0> Time.gm(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,"+0300")
Tue Jul 16 21:25:08 UTC 2002
irb(main):017:0>

The only way to change the timezone I found is using either #gm or
#local but then I’m stuck to my local timezone.

Any help would be appreciated,
-billy.

···


Meisterbohne Söflinger Straße 100 Tel: +49-731-399 499-0
eLösungen 89077 Ulm Fax: +49-731-399 499-9

Hi,

Hello,

how can I parse a Date from a String into a Time
object?

I tried the following but the timezone seems to be
ignored:

irb(main):012:0> t = ParseDate.parsedate(“Tue, 16
Jul 2002 21:25:08 +0200”)
[2002, 7, 16, 21, 25, 8, “+0200”, 2]
irb(main):013:0>

Time.gm(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,t[7])

Tue Jul 16 21:25:08 UTC 2002
irb(main):014:0>

Time.local(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,t[7])

Tue Jul 16 21:25:08 CEST 2002
irb(main):015:0>

Time.local(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,"+0300")

Tue Jul 16 21:25:08 CEST 2002
irb(main):016:0>

Time.gm(t[5],t[4],t[3],t[2],t[1],t[0],nil,nil,nil,"+0300")

Tue Jul 16 21:25:08 UTC 2002
irb(main):017:0>

require ‘time’

t = Time.rfc2822(“Tue, 16 Jul 2002 21:25:08 +0200”)

Park Heesob

···

— Philipp Meier meier@meisterbohne.de wrote:


Do You Yahoo!?
Yahoo! Health - Feel better, live better