Oct-08-2021, 04:30 PM
The following page explains, using examples, most of the datetime methods: https://pymotw.com/3/datetime/
here are some helpers:
here are some helpers:
import datetime # to get today's date today = datetime.date.today() # to calculate date for Feb 29, 2012 (a leap year) thedate = datetime.date(2012, 2, 29) # to get delta in days form today (this is an absolute value) delta = today - thedate print(f"The delta is {delta.days} days")
Output:The delta is 3509 days