Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Time#gmt?

gmt?

Alias of #utc?

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

Related: Time.utc.

See also #utc? #getutc #gmtime #getlocal also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0