Write a Python program to Add five days from current date


The program prints today's date and the date 5 days from now. First, the datetime module is imported. Then, today's date is obtained using the datetime.date.today() function and stored in the dt variable. Next, a new date object is created using the current date plus 5 days by adding a datetime.timedelta object with days=5 to dt, and this new date is stored in the nd variable. Finally, the program prints the dt and nd variables, which represent today's date and the date 5 days from now, respectively.

Source Code

import datetime
dt = datetime.date.today()
nd = dt+datetime.timedelta(days=5)
print(dt)
print(nd)

Output

2022-09-24
2022-09-29

Example Programs