Python add days to a date

Hi Team,
I am new to Python. Can you please help with how to add days to a date that is in string format? please find below the sample. I would like to add 15 days to the generateddate Can you provide a sample code


Pavan K

This is made easy by the datetime module of the standard library.

import datetime

generated_date = "10/30/2020"

# Split the date by slashes and unpack the components.
month, day, year = generated_date.split("/")

# Create a date object. The parameters must be
# converted to integers (they are strings).
date =, month=int(month), day=int(day))

# Create a delta object for the difference.
delta = datetime.timedelta(days=10)

# Add them.
new_date = date + delta

# Format the result.
new_date_formatted = f"{new_date.month}/{}/{new_date.year}"


Some references:

Hi jeanas,

Fabulous!!! It worked perfectly. You made my day. struggled couple of days to get this.
Thanks for helping hand

Pavan K