Skip to content

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

instance method

Time#utc?

utc? → true or false

Returns true if self represents a time in UTC (GMT):

Example
now = Time.now
# => 2022-08-18 10:24:13.5398485 -0500
now.utc? # => false
utc = Time.utc(2000, 1, 1, 20, 15, 1)
# => 2000-01-01 20:15:01 UTC
utc.utc? # => true

Time#gmt? is an alias for Time#utc?.

Related: Time.utc.

See also .utc #utc #utc_offset #usec also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0