How To Get Yesterday Date In Python?




How To Get Yesterday Date In Python?

Hello Friends,

Now let's see example of how to get yesterday date from current date day in python. I am going to show you python get current date yesterday day. We will learn get current date yesterday 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 get yesterday a day in python.

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

Let's start following example.

Example : 1

# import datetime module

from datetime import datetime,timedelta

currentTimeDate = - timedelta(days=1)

currentTime = currentTimeDate.strftime('%Y-%m-%d')


Run Example




It will help you....