Python Add Days in Date Example Tutorial

Published On: 06/06/2022 | Category: Python

Hello Guys,

In this article we will cover on how to implement python date adding days. I’m going to show you about how to add days to current date in python. it's simple example of how to add days date in python datetime . you'll learn add days to date python pandas.

Here I will give an example for how to add days to date in python. I am use datetime and time module to add days date. So let's see the below example:

Example : 1
# import datetime module
from datetime import datetime,timedelta

currentTimeDate = datetime.now() + timedelta(5)
currentTime = currentTimeDate.strftime('%Y-%m-%d')

print(currentTime)
Output:
2022-06-11
Example : 2
# import datetime module
from datetime import timedelta, date

currentTimeDate = date.today() + timedelta(10)
currentTime = currentTimeDate.strftime('%Y-%m-%d')

print(currentTime)
Output:
2022-06-16
Example : 3
# import pandas module
import pandas as pd

my_date = "2022-06-06"
res_date = pd.to_datetime(my_date) + pd.DateOffset(days=15)

print(res_date)
Output:
2022-06-21 00:00:00

It will help you....