Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Time#zone

time.zone → string or timezone

Returns the name of the time zone used for time. As of Ruby 1.8, returns “UTC” rather than “GMT” for UTC times.

Example
t = Time.gm(2000, "jan", 1, 20, 15, 1)
t.zone   #=> "UTC"
t = Time.local(2000, "jan", 1, 20, 15, 1)
t.zone   #=> "CST"
See also #year #yday also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0