Python ProgrammingPython Programming

Python difference between two dates in days

from datetime import date

d1 = date(2019, 8, 18)
d2 = date(2021, 12, 10)

days_diff = d2 - d1
print(days_diff.days)
Output
845