date and timedelta arithmetic
date(year, month, day)
date.isoformat()
timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)Construct a calendar date and shift it by a duration.
Raises
ValueError— Raised when the year, month, or day is out of range, for example date(2026, 2, 31).
from datetime import date, timedelta
start = date(2026, 11, 21)
print(start.isoformat())
print((start + timedelta(days=10)).isoformat())
print((start - date(2026, 11, 1)).days)Expected output
2026-11-21
2026-12-01
20