Ruby | Time eql?() function Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The eql?() is an inbuilt method in Ruby returns true if time and other time are both time objects with the same seconds and fractional seconds otherwise false Syntax: time.eql?() Parameters: The function accepts no parameter Return Value: It returns true if time and other time are both time objects with the same seconds and fractional seconds otherwise false Example 1: CPP # Ruby code for eql?() method # Include Time require 'time' # Declaring time a = Time.new(2000, 12, 23, 9, 3, 3.0) b = Time.new(2000, 12, 23, 9, 3, 3.0) # Prints boolean value puts a.eql?(b) Output: true Example 2: CPP # Ruby code for eql?() method # Include Time require 'time' # Declaring time a = Time.new(2000, 12, 23, 9, 3, 3.0) b = Time.new(2000, 12, 23, 9, 3, 4.0) # Prints boolean value puts a.eql?(b) Output: false Comment More infoAdvertise with us Next Article Ruby | Time eql?() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Time-class Similar Reads 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 ctime() function The ctime() is an inbuilt method in Ruby returns a canonical string representation of time. Syntax: time.ctime() Parameters: The function accepts no parameter Return Value: It returns a canonical string representation of time. Example 1: CPP # Ruby code for ctime() method # Include Time require 'tim 1 min read Ruby | Time day() function The day() is an inbuilt method in Ruby returns the day of the month for time. Syntax: time.day() Parameters: The function accepts no parameter Return Value: It returns the day of the month for time. Example 1: CPP # Ruby code for day() method # Include Time require 'time' # Declaring time a = Time.n 1 min read Ruby | Time dst?() function The dst?() is an inbuilt method in Ruby returns true if time occurs during Daylight Saving Time in its time zone otherwise false Syntax: time.dst?() Parameters: The function accepts no parameter Return Value: It returns true if time occurs during Daylight Saving Time in its time zone otherwise false 1 min read Like