class method
self.days_in_month
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
self.days_in_month(month, year = now.year)
Return the number of days in the given month. If no year is specified, it will use the current year.
Parameters
-
monthreq -
yearopt = now.year
Source
# File activesupport/lib/active_support/core_ext/time/calculations.rb, line 18
def days_in_month(month, year = now.year)
return 29 if month == 2 && ::Date.gregorian_leap?(year)
COMMON_YEAR_DAYS_IN_MONTH[month]
end
Defined in activesupport/lib/active_support/core_ext/time/calculations.rb line 18
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Time