09-Oct-2021
.
Admin
Hello Friends,
Now let's see example of how to get current date minus 1 day in python. I am going to show you python get current date sub day. We will learn get current date minus a day using python.
The datetime module is supplies classes for manipulating dates and times. This article will give you example of get current date then minus a day in python.
Here I will give two example for how to get current date substract day in python. I am use datetime and time module to get current date minus day. So let's see the below example:
Example 1
from datetime import datetime,timedelta
currentTimeDate = datetime.now() - timedelta(days=1)
currentTime = currentTimeDate.strftime('%Y-%m:%d')
print(currentTime)
Output:
2021-09-08
It will help you....
#Python