Print day before yesterday,yesterday, today, tomorrow,day after tomorrow dates in python
Answers
Answered by
4
#Code by RockstarPratheek
import datetime
today = datetime.date.today()
daybeforeyesterday = today - datetime.timedelta(days = 2)
yesterday = today - datetime.timedelta(days = 1)
tomorrow = today + datetime.timedelta(days = 1)
dayaftertomorrow = today + datetime.timedelta(days = 2)
print('Day Before Yesterday : ',daybeforeyesterday)
print('Yesterday : ',yesterday)
print('Today : ',today)
print('Tomorrow : ',tomorrow)
print('Day After Tomorrow : ',dayaftertomorrow)
#Code by RockstarPratheek
#Given at @Brainly.in
Answered by
0
import datetime
yesterday = datetime.datetime.now() - datetime.timedelta(days = 1)
print yesterday.strftime("%m%d%y")
Similar questions