belongs to collection: Python Date and Time Exercises
Given:
given_date = datetime(2020, 2, 25)
Expected output:
2020-02-18
Solution:
from datetime import datetime, timedelta given_date = datetime(2020, 2, 25) print("Given date") print(given_date) days_to_subtract = 7 res_date = given_date - timedelta(days=days_to_subtract) print("New Date") print(res_date)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer