Skip to content
Related Articles

Related Articles

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

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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()

chevron_right


Output:

23

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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()

chevron_right


Output:

27
My Personal Notes arrow_drop_up
Recommended Articles
Page :