Ruby | Time isdst function Last Updated : 21 Jul, 2021 Comments Improve Suggest changes Like Article Like Report Time#isdst(): isdst() is a Time class method which checks whether the time occurs during Daylight Saving Time in its time zone. Syntax: Time.isdst()Parameter: Time valuesReturn: true - if the time occurs during Daylight Saving Time in its time zone otherwise return false Example #1 : Ruby # Ruby code for Time.isdst() method # declaring time a = Time.new(2019) # declaring time b = Time.new(2019, 10) # declaring time c = Time.new(2019, 12, 31) # Time puts "Time a : #{a}\n\n" puts "Time b : #{b}\n\n" puts "Time c : #{c}\n\n\n\n" # isdst form puts "Time a isdst form : #{a.isdst}\n\n" puts "Time b isdst form : #{b.isdst}\n\n" puts "Time c isdst form : #{c.isdst}\n\n" Output : Time a : 2019-01-01 00:00:00 +0100 Time b : 2019-10-01 00:00:00 +0200 Time c : 2019-12-31 00:00:00 +0100 Time a isdst form : false Time b isdst form : true Time c isdst form : false Example #2 : Ruby # Ruby code for Time.isdst() method # declaring time a = Time.now # declaring time b = Time.new(1000, 10, 10) # declaring time c = Time.new(2020, 12) # Time puts "Time a : #{a}\n\n" puts "Time b : #{b}\n\n" puts "Time c : #{c}\n\n\n\n" # isdst form puts "Time a isdst form : #{a.isdst}\n\n" puts "Time b isdst form : #{b.isdst}\n\n" puts "Time c isdst form : #{c.isdst}\n\n" Output : Time a : 2019-08-27 03:48:18 +0200 Time b : 1000-10-10 00:00:00 +0053 Time c : 2020-12-01 00:00:00 +0100 Time a isdst form : true Time b isdst form : false Time c isdst form : false Comment More infoAdvertise with us Next Article Ruby | Time + function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Time-class Similar Reads Ruby | Time inspect function Time#inspect() is a Time class method which returns the string representation of the time. Syntax: Time.inspect()Parameter: Time valuesReturn: string representation of the time. Example #1 :  Ruby # Ruby code for Time.inspect() method # declaring time a = Time.new(2019) # declaring time b = Time.n 2 min read Ruby | Time min function Time#min() : min() is a Time class method which returns the minute of the hour from 0 to 59 for time. Syntax: Time.min() Parameter: Time values Return: minute of the hour from 0 to 59 for time. Example #1 : Ruby # Ruby code for Time.min() method # declaring time a = Time.new(2019) # declaring time b 2 min read Ruby | Time gmt? function Time#gmt?() is a Time class method which checks whether the time represents a time in UTC (GMT). Syntax: Time.gmt?() Parameter: Time values Return: true - if time represents a time in UTC (GMT) otherwise return false Example #1 : Ruby 1=1 # Ruby code for Time.gmt?() method # declaring time a = Time. 2 min read Ruby | Time - function Time#-() is a Time class method which returns a new time value after subtracting seconds from it. Syntax: Time.-() Parameter: Time values Return: new time value after subtracting seconds from it. Example #1 : Ruby # Ruby code for Time.-() method # declaring time a = Time.new(2019) # declaring time b 2 min read Ruby | Time + function Time#+() is a Time class method which returns a new time value after adding seconds to it. Syntax: Time.+() Parameter: Time values Return: new time value after adding seconds to it Example #1 : Ruby # Ruby code for Time.+() method # declaring time a = Time.new(2019) # declaring time b = Time.new(201 2 min read Ruby | Time to_i() function Time#to_i() is a Time class method which returns the value of time as an integer number of seconds since the Epoch. Syntax: Time.to_i() Parameter: Time values Return: value of time as an integer number of seconds since the Epoch. Example #1 : Ruby # Ruby code for Time.to_i() method # loading library 2 min read Like