Date, Time and Localization Modules

zoneinfo

Provides IANA regional time-zone rules through ZoneInfo. It reads system zone data or the optional tzdata package and raises ZoneInfoNotFoundError when a requested zone is unavailable. Use fold to distinguish repeated local times during backward transitions. Convert via UTC when comparing elapsed intervals across offset changes.

Formal Syntax & Structure

python syntaxpython
import zoneinfo

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from datetime import datetime, timezonefrom zoneinfo import ZoneInfomoment = datetime(2024, 7, 1, 12, tzinfo=timezone.utc)print(moment.astimezone(ZoneInfo("Europe/Paris")).isoformat())
Python Reference