October 2006
Intermediate to advanced
888 pages
16h 55m
English
It is only convenient to work with two time zones: GMT (or UTC) is one, and the other is whatever time zone you happen to be in.
The gmtime method converts a time to GMT (changing the receiver in place). There is an alias named utc.
You might expect that it would be possible to convert a time to an array, tweak the time zone, and convert it back. The trouble with this is that all the class methods such as local and gm (or their aliases mktime and utc) want to create a Time object using either your local time zone or GMT.
There is a workaround to get time zone conversions. This does require that you know the time difference in advance. See the following code fragment:
mississippi = Time.local(2000,11,13,9,35) # 9:35 ...
Read now
Unlock full access