Open In App

Ruby | Time mday() function

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report
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 = Time.new(2000, 12, 23)

# Prints the day of the month for the time
puts a.mday()
Output:
23
Example 2: CPP
# Ruby code for mday() method

# Include Time
require 'time'

# Declaring time 
a = Time.now()

# Prints the day of the month for the time
puts a.mday()
Output:
27

Similar Reads