cf.Y

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

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

cf.Y() is equivalent to cf.TimeDuration(1, 'calendar_year').

cf.Y(duration, *args, **kwargs) is equivalent to cf.TimeDuration(duration, 'calendar_year', *args, **kwargs).

New in version 1.0.

See also

cf.M, cf.D, cf.h, cf.m, cf.s

Parameters
duration: number, optional

The number of calendar years in the time duration.

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.

Parameter example:

cf.Y(month=12) is equivalent to cf.TimeDuration(1, 'calendar_years', month=12).

Returns
TimeDuration

The new cf.TimeDuration object.

Examples

>>> cf.Y()
<CF TimeDuration: P1Y (Y-01-01 00:00:00)>
>>> cf.Y(10, month=12)
<CF TimeDuration: P10Y (Y-12-01 00:00:00)>
>>> cf.Y(15, month=4, day=2, hour=12, minute=30, second=2)
<CF TimeDuration: P15Y (Y-04-02 12:30:02)>
>>> cf.Y(0)
<CF TimeDuration: P0Y (Y-M-01 00:00:00)>