scientiffic scientiffic - 1 year ago 116
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?

Answer Source

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download