Python datetime.combine() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
classmethod

Definition

datetime.combine(date, time) builds a new datetime whose year, month, and day come from the date and whose hour, minute, second, and microsecond come from the time.

The result copies the time's tzinfo, so an aware time gives an aware datetime. The optional tzinfo argument (Python 3.6+) overrides that zone. It is the reverse of splitting with date() and timetz().

datetime.combine() is a classmethod of datetime.datetime: call it on the class itself, as datetime.combine(...), and it returns a new object. Import the class first, for example from datetime import datetime.

Syntax

Pass a date, a time, and optionally a tzinfo.

python
moment = datetime.combine(date, time)
moment = datetime.combine(date, time, tzinfo=tz)
CallWhat it does
datetime.combine(date(2024, 9, 2), time(14, 30))Returns datetime.datetime(2024, 9, 2, 14, 30).
datetime.combine(date(2024, 9, 2), time(9, tzinfo=timezone.utc))Returns datetime.datetime(2024, 9, 2, 9, 0, tzinfo=datetime.timezone.utc).
datetime.combine(d, time.min)Gives midnight at the start of day d; time.min is 00:00.

If the first argument is a datetime, only its date part is used; its time and zone are ignored.

Method signatures
python
classmethod datetime.combine(date, time, tzinfo=time.tzinfo)
# date: a date (or datetime) object
# time: a time object
# tzinfo: optional, overrides the time's tzinfo (Python 3.6+)

Parameters

ParameterDescription
dateThe calendar day, a date object.
timeThe clock time, a time object.
tzinfoOptional. The zone for the result; by default the time's own tzinfo.

Return Value

Return ValueDescription
datetimeA new datetime made of the date fields and the time fields.

Python Examples

Example 1 — Join a Date and a Time

Combine a meeting day with a start time, check the weekday, and build midnight with time.min.

python
from datetime import date, datetime, time

meeting_day = date(2024, 9, 2)
start = time(14, 30)

moment = datetime.combine(meeting_day, start)
print(moment)
print(moment.weekday())
print(datetime.combine(meeting_day, time.min))

How It Works

  1. Two halves. The date supplies 2 September 2024 and the time supplies 14:30.
  2. Full datetime. The result has every datetime method, such as weekday(), which returns 0 for Monday.
  3. Start of day. time.min is time(0, 0), so the combination is midnight.

Example 2 — Control the Time Zone of the Result

An aware time passes its zone to the result. The tzinfo argument replaces it without changing the clock reading.

python
from datetime import date, datetime, time, timedelta, timezone

cet = timezone(timedelta(hours=1), "CET")
opening = time(9, 0, tzinfo=cet)
day = date(2025, 1, 20)

print(datetime.combine(day, opening))
print(datetime.combine(day, opening, tzinfo=timezone.utc))
print(datetime.combine(day, opening).astimezone(timezone.utc).time())

How It Works

  1. Zone copied. The time carries CET (UTC+01:00), so the combined datetime is aware with the same offset.
  2. Zone replaced. tzinfo=timezone.utc keeps 09:00 but labels it UTC, which is a different instant.
  3. Real conversion. astimezone() turns 09:00 CET into 08:00 UTC.

Example 3 — Build Night Shifts That Cross Midnight

Combine each date with a 22:00 start and add eight hours. The end time rolls into the next day, month, and year automatically.

python
from datetime import date, datetime, time, timedelta

shift_start = time(22, 0)
shift_length = timedelta(hours=8)

for offset in range(3):
    day = date(2024, 12, 30) + timedelta(days=offset)
    start = datetime.combine(day, shift_start)
    end = start + shift_length
    print(start.strftime("%a %d %b %H:%M"), "->", end.strftime("%a %d %b %H:%M"))

How It Works

  1. Plain time objects cannot overflow. A time has no date, so you cannot add 8 hours to it directly; combining first solves that.
  2. Arithmetic on datetime. Adding a timedelta to the combined value moves past midnight and into 2025 correctly.
  3. Readable labels. strftime() prints the short weekday and month names of the default C/English locale.

Frequently Asked Questions

Use datetime.combine(d, t), for example datetime.combine(date(2024, 9, 2), time(14, 30)).
datetime.combine(d, time.min), or datetime.combine(d, time()), gives 00:00 on that day.
Yes. The result uses the time's tzinfo unless you pass the tzinfo argument.
No, it only attaches a zone. Use astimezone() afterwards to convert.
No, time objects do not support it. Combine with a date first, add the timedelta, then take .time() if needed.

Next: datetime.ctime()

Return a fixed C-style string such as 'Fri Mar 15 10:30:45 2024'.

ctime() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful