I need to calculate the number of days between two dates. One will be today and the other one is -2580,01,01.
I have tried with the datetime
library but I can't because the datetime
library don't accept negative years (MIN=1, MAX=9999).
I have tried with dateutil.relativedelta
:
from datetime import *
from dateutil.relativedelta import *
import calendar
RightNOW = datetime.now() # with full time
JustTODAY = date.today() # only days
PastTime = JustTODAY+relativedelta(years=-4600)
print(PastTime)
Traceback (most recent call last):
File "GoblinTest.py", line 11, in <module>
PastTime = JustTODAY+relativedelta(years=-4600)
File "/usr/lib/python3.8/site-packages/dateutil/relativedelta.py", line 405, in __radd__
return self.__add__(other)
File "/usr/lib/python3.8/site-packages/dateutil/relativedelta.py", line 387, in __add__
ret = (other.replace(**repl)
ValueError: year -2580 is out of range