In this post we will see how to find yesterday’s, today’s and tomorrow’s date in python. This program is very simple and I hope it will helpful to you as well.

Let’s write the program as below using various date functions such as today() and timedelta().

from datetime import datetime, timedelta
# Today's date
today = # or presentday =
# Yesterday's Date
yesterday = today - timedelta(1)
# Tomorrow's Date
tomorrow = today + timedelta(1)
# strftime() - format date to string
print("Yesterday's Date was = ", yesterday.strftime('%d-%m-%Y'))
print("Today's Date is = ", today.strftime('%d-%m-%Y'))
print("Tomorrow's Date is = ", tomorrow.strftime('%d-%m-%Y'))

In the above program strftime() is used to format date to string and timedelta class helps to find the previous day date and next day date.


Happy Coding!