cf.TimeDuration.days_in_month

classmethod TimeDuration.days_in_month(year, month, calendar=None, leap_month=2, month_lengths=None)[source]

The number of days in a specific month in a specific year in a specific calendar.

New in version 1.4.

Parameters
year: int

TODO

month: int

TODO

calendar: str, optional

By default, calendar is the mixed Gregorian/Julian calendar as defined by Udunits.

leap_month: int, optional

The leap month. By default the leap month is 2, i.e. the seond month of the year.

month_lengths: sequence of int, optional

By default, month_lengths is [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31].

Returns
int

The number of days in the specified month.

Examples:

>>> cf.TimeDuration.days_in_month(2004, 2, calendar='360_day')
30