Ruby | Time saturday?() function
The saturday?() is an inbuilt method in Ruby returns true if time represents saturday otherwise false.
Syntax: time.saturday?()
Parameters: The function accepts no parameter
Return Value: It returns true if time represents saturday otherwise false.
Example 1:
# Ruby code for saturday?() method # Include Timerequire 'time' # Declaring time a = Time.new(2000, 12, 23) # Prints boolean valueputs a.saturday?() |
Output:
true
Example 2:
# Ruby code for saturday?() method # Include Timerequire 'time' # Declaring time a = Time.now() # Prints boolean valueputs a.saturday?() |
Output:
false


