How to subtract days from a date in Python

Subtracting days from a datetime.date results in a new datetime.date holding the date that is the desired number of days prior to the original date.

Solution for How to subtract days from a date in Python : You can use datetime.timedelta() to subtract days from a date Call datetime.timedelta(days) to get a duration of days. Subtract this duration of days from a datetime.date to get a new datetime.date.


how-to-subtract-days-from-a-date-in-python