datetime, date, time, and timedelta
corebeginnerdate holds a calendar day, time holds a clock reading with no day, datetime combines both into one point in time, and timedelta holds a duration you can add to or subtract from any of the other three.
Think of it as
Think of date as a page torn from a calendar, time as a reading off a clock with no date printed on it, and datetime as the two taped together into one specific moment. timedelta is not a moment at all — it is a length of time, like "3 days" or "90 minutes", that shifts a date or datetime forward or backward when added.
What we're doing: Compute a countdown in whole days with date, then build a specific meeting instant by combining that date with a time.
- 4
- Subtracting two date objects gives a timedelta measured in whole days — there is no clock time to lose precision on.
- 5
- .days pulls the integer day count out of the timedelta.
- 7
- datetime.combine(launch_date, time(9, 30)) builds one specific instant out of a separate date and time value.
11 days, 0:00:00
11
2026-09-01 09:30:00
2026-09-01 11:00:00Why this works: date subtraction is exact because a date has no time-of-day component to round — the result is always a whole number of days. datetime.combine is the standard way to build a specific instant when a date and a time of day come from separate sources, such as a date picker and a time picker in a form.
Subtracting a date from a datetime (or the reverse)
Wrong
Better
What you see: TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'datetime.date'.
Why: datetime and date are different types with no defined subtraction between them, even though a datetime is conceptually "a date plus a time". Convert the date to a datetime first with datetime.combine — usually pairing it with datetime.min.time() for midnight.
- date and time, separately
- date(2026, 8, 21) — a day, no clock reading
- time(9, 30) — a clock reading, no day
- Neither alone is a point on a timeline
- datetime, combined
- datetime(2026, 8, 21, 9, 30) — both at once
- datetime.combine(d, t) builds one from the other two
- Only this form is a specific instant you can order or diff precisely
The four datetime.* types — what each one holds
Together
Remember: date is a day, time is a clock reading, datetime is both together as one instant, and timedelta is a duration you add to or subtract from any of the first three — but never mix a bare date with a datetime in arithmetic.
See also: datetime and zoneinfo · naive vs aware datetimes · timezones utc and zoneinfo

