Source Code:
(back to article)
from datetime import datetime date = datetime(2022, 1, 1) subtracted_date = date.replace(day=date.day-1) print(subtracted_date) # Output: 2022-01-31 00:00:00
Result:
Report an issue