Number of Days in the Month of the given Date

daysPerMonth(date)

Arguments

date

date object

Value

(integer) number of days in the month of the given date

Examples

# You may either pass a Date object... daysPerMonth(as.Date("2010-01-04"))
#> [1] 31
# ... or a date string in yyyy-mm-dd format daysPerMonth("2010-01-04")
#> [1] 31
# Number of days in February 2010 daysPerMonth("2010-02-01")
#> [1] 28
# Number of days in February 2012 daysPerMonth("2012-02-15")
#> [1] 29