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

Return a time duration of days in a cf.TimeDuration object.

cf.D() is equivalent to cf.TimeDuration(1, 'day').

New in version 1.0.

See also

cf.Y, cf.M, cf.h, cf.m, cf.s

duration: number, optional

The number of days 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.D(hour=12) is equivalent to cf.TimeDuration(1, 'day', hour=12).


The new cf.TimeDuration object.


>>> cf.D()
<CF TimeDuration: P1D (Y-M-D 00:00:00)>
>>> cf.D(5, hour=12)
<CF TimeDuration: P5D (Y-M-D 12:00:00)>
>>> cf.D(48.5, minute=30)
<CF TimeDuration: P48.5D (Y-M-D 00:30:00)>
>>> cf.D(0.25, hour=6, minute=30, second=20)
<CF TimeDuration: P0.25D (Y-M-D 06:30:20)>
>>> cf.D(0)
<CF TimeDuration: P0D (Y-M-D 00:00:00)>