cf.M

cf.M(duration=1, year=None, month=1, day=1, hour=0, minute=0, second=0)[source]

Return a time duration of calendar months in a cf.TimeDuration object.

cf.M() is equivalent to cf.TimeDuration(1, 'calendar_month').

See also

cf.Y, cf.D, cf.h, cf.m, cf.s

New in version 1.0.

Parameters:
duration: int, optional

The number of calendar months in the time duration. Must be a non-negative integer.

year, month, day, hour, minute, second: int, optional

The default date-time elements for defining the start and end of a time interval based on this time duration. See cf.TimeDuration and cf.TimeDuration.interval for details.

Example:

cf.M(day=16) is equivalent to cf.TimeDuration(1, 'calendar_months', day=16).

Returns:
out: cf.TimeDuration

The new cf.TimeDuration object.

Examples:
>>> cf.M()
<CF TimeDuration: 1 calendar month (from Y-MM-01 00:00:00)>
>>> cf.M(3, day=16)
<CF TimeDuration: 3 calendar months (from Y-MM-16 00:00:00)>
>>> cf.M(24, day=2, hour=12, minute=30, second=2)
<CF TimeDuration: 24 calendar months (from Y-MM-02 12:30:02)>
>>> cf.M(0)
<CF TimeDuration: 0 calendar months (from Y-MM-01 00:00:00)>