How do I change the zone offset for a time in ruby?

Posted by Janak on Stack Overflow See other posts from Stack Overflow or by Janak
Published on 2009-06-26T12:45:14Z Indexed on 2010/06/08 6:52 UTC
Read the original article Hit count: 315

Filed under:
|

I have a variable foo that contains a time, lets say 4pm today, but the zone offset is wrong, i.e. it is in the wrong time zone. How do I change the time zone?

When I print it I get

Fri Jun 26 07:00:00 UTC 2009

So there is no offset, and I would like to set the offset to -4 or Eastern Standard Time.

I would expect to be able to just set the offset as a property of the Time object, but that doesn't seem to be available?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby