Skip to main content

make_aware

Set timezone for a :class:~datetime.datetime object.

def make_aware(
dt: datetime,
tz: tzinfo
) - > datetime

Set timezone for a :class:~datetime.datetime object.

Parameters

NameTypeDescription
dtdatetimeThe naive or aware datetime object to be updated with a specific timezone.
tztzinfoThe timezone information object to apply to the datetime.

Returns

TypeDescription
datetimeThe timezone-aware datetime object, adjusted to the earliest possible time if the transition is ambiguous.