Ruby | Time monday? function Last Updated : 07 Jan, 2020 Comments Improve Suggest changes Like Article Like Report Time#monday?() is a Time class method which checks whether the time represents Monday. Syntax: Time.monday?() Parameter: Time values Return: true - if the time represents Monday otherwise false Example #1 : Ruby # Ruby code for Time.monday?() 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" # monday? form puts "Time a monday? form : #{a.monday?}\n\n" puts "Time b monday? form : #{b.monday?}\n\n" puts "Time c monday? form : #{c.monday?}\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 monday? form : false Time b monday? form : false Time c monday? form : false Example #2 : Ruby # Ruby code for Time.monday?() 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" # monday? form puts "Time a monday? form : #{a.monday?}\n\n" puts "Time b monday? form : #{b.monday?}\n\n" puts "Time c monday? form : #{c.monday?}\n\n" Output : Time a : 2019-08-27 04:00:19 +0200 Time b : 1000-10-10 00:00:00 +0053 Time c : 2020-12-01 00:00:00 +0100 Time a monday? form : false Time b monday? form : false Time c monday? form : false Comment More infoAdvertise with us Next Article Ruby | Time monday? function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby Time-class Similar Reads Ruby | Time mday() function The mday() is an inbuilt method in Ruby returns the day of the month for time. Syntax: time.mday() Parameters: The function accepts no parameter Return Value: It returns the day of the month for time. Example 1: CPP # Ruby code for mday() method # Include Time require 'time' # Declaring time a = Tim 1 min read Ruby | Time mon() function The mon() is an inbuilt method in Ruby returns the month of the year for time. Syntax: time.mon() Parameters: The function accepts no parameter Return Value: It returns the month of the year for time. Example 1: CPP # Ruby code for mon() method # Include Time require 'time' # Declaring time a = Time 1 min read Ruby | Time month() function The month() is an inbuilt method in Ruby returns the month of the year for time. Syntax: time.month() Parameters: The function accepts no parameter Return Value: It returns the month of the year for time. Example 1: CPP # Ruby code for month() method # Include Time require 'time' # Declaring time a 1 min read Ruby | Time round function Time#round() is a Time class method which returns a new time object by rounding sub seconds to a given precision in decimal digits. Syntax: Time.round() Parameter: Time values Return: a new time object by rounding sub seconds to a given precision in decimal digits. Example #1 : Ruby # Ruby code for 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 Like