Ruby | Time day() function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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.new(2000, 12, 23) # Prints the day of the month for the time puts a.day() Output: 23 Example 2: CPP # Ruby code for day() method # Include Time require 'time' # Declaring time a = Time.now() # Prints the day of the month for the time puts a.day() Output: 27 Comment More infoAdvertise with us Next Article Ruby | Time to_date() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Time-class Similar Reads Ruby | Time friday? function Time#friday?() is a Time class method which checks whether the time represent Friday. Syntax: Time.friday?() Parameter: Time values Return: true - if time represent Friday otherwise return false Example #1 : Ruby # Ruby code for Time.friday?() method # declaring time a = Time.new(2019) # declaring t 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_a() function Time#to_a() is a Time class method which returns the string which returns a ten-element array of values for time. Format [sec, min, hour, day, month, year, wday, yday, isdst, zone] Syntax: Time.to_a() Parameter: Time values Return: a ten-element array of values for time. Example #1 : Ruby # Ruby cod 2 min read Ruby | Time to_date() function Time#to_date() is a Time class method which returns a self Date object. Syntax: Time.to_date() Parameter: Time values Return: a self Date object. Example #1 : Ruby # Ruby code for Time.to_date() method # loading library require 'time' # declaring time a = Time.new(2019) # declaring time b = Time.new 2 min read Ruby | Time to_f function Time#to_f() : to_f() is a Time class method which returns the value of time as a floating point number of seconds since the Epoch. Syntax: Time.to_f() Parameter: Time values Return: value of time as a floating point number of seconds since the Epoch. Example #1 : Ruby # Ruby code for Time.to_f() met 2 min read Like