1from datetime import date, timedelta
2
3current_date = date.today().isoformat()
4days_before = (date.today()-timedelta(days=30)).isoformat()
5days_after = (date.today()+timedelta(days=30)).isoformat()
6
7print("\nCurrent Date: ",current_date)
8print("30 days before current date: ",days_before)
9print("30 days after current date : ",days_after)
10
11
1import datetime
2
3Current_Date_Formatted = datetime.datetime.today().strftime ('%d%m%Y') # format the date to ddmmyyyy
4print ('Current Date: ' + str(Current_Date_Formatted))
5
6Previous_Date = datetime.datetime.today() - datetime.timedelta(days=1)
7Previous_Date_Formatted = Previous_Date.strftime ('%d%m%Y') # format the date to ddmmyyyy
8print ('Previous Date: ' + str(Previous_Date_Formatted))
9
10NextDay_Date = datetime.datetime.today() + datetime.timedelta(days=1)
11NextDay_Date_Formatted = NextDay_Date.strftime ('%d%m%Y') # format the date to ddmmyyyy
12print ('Next Date: ' + str(NextDay_Date_Formatted))
13