Adding days to a date in Python

The timedelta object from the datetime module allows you to add any number of days to a date object.

In this example I always take the current date using the date.today() method.

Then I set a timedelta of 2 days and add it to the current_date.

from datetime import timedelta, date

current_date = date.today()

print(current_date)

future_date = current_date + timedelta(days=2)

print(future_date)
2020-04-27
2020-05-29

Watch this Content