scientiffic scientiffic - 2 months ago 10x
Ruby Question

Get UTC offset in Ruby

I'm trying to get the UTC offset for a datetime. The datetime is saved as:

Fri, 31 May 2013 15:19:08 EDT -04:00

What I'd like to get is
. When I do
, I get
. What function should I use?


You are looking for strftime:"%:z")

That will give you the timezone such as "-04:00".