The program demonstrates how to get the date that is three days before the current date. Here's how the program works:
The timedelta class is used to represent the difference between two dates or times. It can be used to perform arithmetic operations on dates, such as adding or subtracting days, weeks, or months from a date. In this program, we subtract three days from the current date to get the date that is three days before the current date.
from datetime import date, timedelta dt = date.today() - timedelta(3) print("Current Date :",date.today()) print("Three days before Current Date :",dt)
Current Date : 2022-09-24 Three days before Current Date : 2022-09-21
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions