Represents a time span.
All arguments are optional and default to 0. Arguments may be integers or floats, and may be positive or negative.
As in the base
datetime.timedeltaclass, only days, seconds and microseconds are stored internally. Arguments are converted to those units:
- A millisecond is converted to 1000 microseconds.
- A minute is converted to 60 seconds.
- An hour is converted to 3600 seconds.
and days, seconds and microseconds are then normalized so that the representation is unique.
If any argument is a float and there are fractional microseconds, the fractional microseconds left over from all arguments are combined and their sum is rounded to the nearest microsecond using round-half-to-even tiebreaker.
- seconds (float,optional) – number of seconds in the time span.
- microseconds (float,optional) – number of microseconds in the time span.
- milliseconds (float,optional) – number of milliseconds in the time span.
- minutes (float,optional) – number of minutes in the time span.
- hours (float,optional) – number of hours in the time span.
- days (float,optional) – number of days in the time span.
Number of days.
Returns a human-readable
TimeSpanobject, represented as time units such as days, hours, minutes, and seconds.
Parameters: trim_zeros (bool,optional) – indicates whether the leading zeros in the result should be skipped Returns: human-readable time span Return type: str
Number of microseconds (>= 0 and less than 1 second).
Number of seconds (>= 0 and less than 1 day).
Total hours in the duration.
Total milliseconds in the duration.
Total minutes in the duration.
Total seconds in the duration.