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#isdst

dst? -> true or false

Returns true if self is in daylight saving time, false otherwise:

Example
t = Time.local(2000, 1, 1) # => 2000-01-01 00:00:00 -0600
t.zone                     # => "Central Standard Time"
t.dst?                     # => false
t = Time.local(2000, 7, 1) # => 2000-07-01 00:00:00 -0500
t.zone                     # => "Central Daylight Time"
t.dst?                     # => true

Time#isdst is an alias for Time#dst?.

See also #inspect #iso8601 #httpdate #localtime also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0