Skip to main content

is_aware

Determine if a given datetime.datetime is aware.

The concept is defined in Python's docs: https://docs.python.org/library/datetime.html#datetime.tzinfo

Assuming value.tzinfo is either None or a proper datetime.tzinfo, value.utcoffset() implements the appropriate logic.

def is_aware(
value: datetime.datetime
) - > boolean

Determine if a given datetime.datetime is aware.

Parameters

NameTypeDescription
valuedatetime.datetimeThe datetime instance to check for timezone awareness

Returns

TypeDescription
booleanTrue if the datetime object includes timezone information and is not naive, False otherwise