Program - Subtract a week from a given date


Topic: Program - Subtract a week from a given date

Solution

from datetime import datetime, timedelta
given_date = datetime(2020, 2, 25)
days_to_subtract = 7
res_date = given_date - timedelta(days=days_to_subtract)
print(res_date)



List all Python Programs