Mega Code Archive

 
Categories / Ruby / Time
 

Checking Whether Daylight Saving Time Is Currently in Effect

puts Time.local(2006, 1, 1)                  # => Sun Jan 01 00:00:00 EST 2006 puts Time.local(2006, 1, 1).isdst            # => false puts Time.local(2006, 10, 1)                 # => Sun Oct 01 00:00:00 EDT 2006 puts Time.local(2006, 10, 1).isdst           # => true