From: nobu.nokada@... Date: 2003-01-14T14:08:46+09:00 Subject: Re: time & timezones Hi, At Sun, 12 Jan 2003 09:27:18 +0900, Martin Pirker wrote: > In internet data (mail/news/logs/...) one handles many time/date > stamps from different timezones. > ParseDate does an amazing job of parsing, but I don't know what > to do with the result. > In order to compare points in time one has to convert all the stamps > to one time zone, e.g. convert them all to GMT/UTC, > but... how do I do this in Ruby? Time#gmtime > Class Time doesn't provide a function to create a new one with > the values from ParseDate (timezone!) - at least I wasn't successful > with the 10 parameter form of .gm ?!? require 'time' puts Time.parse("Tue Jan 14 14:02:43 JST 2003").gmtime # => Tue Jan 14 05:02:43 UTC 2003 puts Time.parse("Tue Jan 14 14:02:43 PDT 2003").gmtime # => Tue Jan 14 21:02:43 UTC 2003 > Bonus question: Is there a function which outputs a Time object > in RFC form (date -R on Linux prompt), as strftime with %Z gives a name, > not easier (re)parseable numbers for timezone? require 'time' puts Time.now.rfc822 -- Nobu Nakada