cf.s¶
-
cf.
s
(duration=1, year=None, 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 tocf.TimeDuration(1, 'second')
.New in version 1.0.
Parameters: - duration: number, optional
The number of hours in the time duration. Must be non-negative.
- 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
andcf.TimeDuration.interval
for details.- Example:
cf.s(hour=6)
is equivalent tocf.TimeDuration(1, 'seconds', hour=6)
.
Returns: - out:
cf.TimeDuration
The new
cf.TimeDuration
object.
Examples: >>> cf.s() <CF TimeDuration: 1 second (from Y-01-01 00:00:00)>
>>> 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-01-01 00:00:00)>
>>> cf.s(0.5) <CF TimeDuration: 0.5 seconds (from Y-01-01 00:00:00)>
>>> cf.s(12.25) <CF TimeDuration: 12.25 seconds (from Y-01-01 00:00:00)>
>>> 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)>