Related Articles

Related Articles

Ruby | Time sunday?() function
  • Last Updated : 07 Jan, 2020

The sunday?() is an inbuilt method in Ruby returns true if time represents sunday otherwise false.

Syntax: time.sunday?()

Parameters: The function accepts no parameter

Return Value: It returns true if time represents sunday otherwise false.



Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby code for sunday?() method
  
# Include Time
require 'time'
  
# Declaring time 
a = Time.new(2000, 12, 23)
  
# Prints boolean value
puts a.sunday?()

chevron_right


Output:

false

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby code for sunday?() method
  
# Include Time
require 'time'
  
# Declaring time 
a = Time.now()
  
# Prints boolean value
puts a.sunday?()

chevron_right


Output:

false
My Personal Notes arrow_drop_up
Recommended Articles
Page :