From: "Mark J. Reed" Date: 2003-11-27T01:42:12+09:00 Subject: Re: Date Class and GMT On Thu, Nov 27, 2003 at 01:31:08AM +0900, Zach Dennis wrote: > I need to be able to return the zone by it's numeric representation( > i.e. -0500 ). Like > > Wed Nov 26 16:29:29 UTC 2003 -0500 (You should have deleted the "UTC" from that, since it refers to the time zone; it's the modern name for GMT.) You want the DateTime class, included in the 'date' library which comes with Ruby: irb(main):001:0> require 'date' => true irb(main):002:0> n=DateTime.now => # irb(main):003:0> n.to_s => "2003-11-26T11:34:32-0500" irb(main):004:0> n.zone => "-0500" irb(main):005:0> n.strftime("%a %b %d %H:%M:%S %Y %Z") => "Wed Nov 26 11:34:32 2003 -0500" However, as I have posted here before, there is a bug in this library which for some reason automatically increases the time zone offset from UTC by one minute, so if you run the above examples on your system you will probably see -0501 instead of -0500. This problem is easily fixed by removing the line d += d / d.abs if d.nonzero? in the definition of DateTime.now (line 511 of date.rb). -Mark