Overview
- Negative time quantity in the context of an event that is to be started could mean the remaining time for that event to start. For example, if a meeting starts by 3.00 PM, at 2.58 PM a time duration of -2 minutes denotes the meeting is starting in 2 minutes.
- The attribute TimeDelta.min provides the biggest of such negative time quantity that can be represented using the TimeDelta class.
Example
# Example Python program that prints
# the minimum time quantity that can be represented
# through the Python class datetime.timedelta
from datetime import timedelta
print(timedelta.min)
print(type(timedelta.min))
# Try creating a timedelta smaller than timedelta.min
print(timedelta(timedelta.min.days-1))Output
Most negative timedelta:
-999999999 days, 0:00:00
<class 'datetime.timedelta'>
Traceback (most recent call last):
File "/Valli/PythonProgs/td_ex1.py", line 12, in <module>
print(timedelta(timedelta.min.days-1))
OverflowError: days=-1000000000; must have magnitude <= 999999999