# Ruby code for mon() method# Include Timerequire'time'# Declaring time
a =Time.new(2000,12,23)# Prints the month of the year for the time
puts a.mon()
Ruby
输出:
12
Ruby
例2 :
# Ruby code for mon() method# Include Timerequire'time'# Declaring time
a =Time.now()# Prints the month of the year for the time
puts a.mon()