Section 7.14. Working with Hours and Minutes Only


7.13. Obtaining the Time Zone

The accessor zone in the Time class returns a String representation of the time zone name.

z1 = Time.gm(2000,11,10,22,5,0).zone     # "GMT-6:00" z2 = Time.local(2000,11,10,22,5,0).zone  # "GMT-6:00"


Unfortunately, times are stored relative to the current time zone, not the one with which the object was created. If necessary, you can do a little arithmetic here.




The Ruby Way(c) Solutions and Techniques in Ruby Programming
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition)
ISBN: 0672328844
EAN: 2147483647
Year: 2004
Pages: 269
Authors: Hal Fulton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net