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

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

cf.s() is equivalent to cf.TimeDuration(1, 'second').

See also

cf.Y, cf.M, cf.D, cf.h, cf.m

New in version 1.0.

duration: number, optional

The number of hours 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.s(hour=6) is equivalent to cf.TimeDuration(1, 'seconds', hour=6).


The new cf.TimeDuration object.


>>> cf.s()   
<CF TimeDuration: 1 second (from Y-M-D h:m:s)>
>>> cf.s().interval(1999, 12, 1)
(<CF Datetime: 1999-12-01 00:00:00>, datetime.datetime(1999, 12, 1, 0, 0, 1))
>>> cf.s(30)
<CF TimeDuration: 30 seconds (from Y-M-D h:m:s)>
>>> cf.s(0.5)
<CF TimeDuration: 0.5 seconds (from  Y-M-D h:m:s)>
>>> cf.s(12.25)
<CF TimeDuration: 12.25 seconds (from Y-M-D h:m:s)>
>>> cf.s(2.5, year=1999, hour=12)
<CF TimeDuration: 2.5 seconds (from 1999-01-01 12:00:00)>
>>> cf.s(0)
<CF TimeDuration: 0 seconds (from Y-01-01 00:00:00)>