zoneinfo — IANA time zone support

zoneinfo.ZoneInfo, ZoneInfoNotFoundError, and DST fold, including the dependency on a local IANA database.

zoneinfo provides IANA time zone support for aware datetime values. Import ZoneInfo from zoneinfo and pass it as tzinfo. The datetime page already covers naive versus aware values, timezone.utc, fixed offsets, and TypeError when mixing naive and aware datetimes. This page starts from named IANA keys such as America/New_York.

ZoneInfo looks up a key in an IANA time zone database: a system zoneinfo directory, or the tzdata package when that is installed. The conversion and fold examples below were recorded on Python 3.13.12 with tzdata 2026.2 available and America/New_York present. Other machines may have a different tzdata version, a different system database, or no database at all. This page cannot guarantee every environment will resolve the same key.

When a key is missing, ZoneInfo raises ZoneInfoNotFoundError, which the first printed line demonstrates with the fake key Not/AZone. Examples do not print filesystem paths.

Examples were checked against Python 3.13. See the official documentation for the complete API.

Python reference overview →

Zone lookup, conversion, and DST fold

datetime(2026, 11, 21, 15, 30, tzinfo=ZoneInfo("UTC")) converted to America/New_York is 10:30 with a -05:00 offset, because that date is in standard time in that zone under the IANA data used here.

On the night the US ends daylight saving time in 2026, 01:30 occurs twice in America/New_York. datetime uses fold=0 for the first occurrence (-04:00) and fold=1 for the second (-05:00). The two values compare equal even though their offsets differ, which is why the last line prints True. fold is a datetime field documented with datetime; zoneinfo supplies the zone that makes both occurrences real.

zoneinfo.ZoneInfo and ZoneInfoNotFoundError

ZoneInfo(key)
exception ZoneInfoNotFoundError

Show a missing key, convert a fixed UTC moment into America/New_York, and print both fold values at the 2026 fallback.

ParameterDescription
keyAn IANA time zone name such as America/New_York or UTC. It is not a fixed offset like UTC+8; use datetime.timezone for those, as on the datetime page.

Returns: A ZoneInfo tzinfo instance when the key exists.

Raises

  • ZoneInfoNotFoundError — Raised when the key is absent from the available IANA data, as with Not/AZone. It is a subclass of KeyError.
  • The America/New_York offsets were measured with Python 3.13.12 and tzdata 2026.2. If that zone is missing where you run the example, ZoneInfoNotFoundError is raised instead of the conversion lines.
python
from datetime import datetime
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError

try:
    tz = ZoneInfo("Not/AZone")
    print("unexpected", tz)
except ZoneInfoNotFoundError as exc:
    print(type(exc).__name__)

ny = ZoneInfo("America/New_York")
moment = datetime(2026, 11, 21, 15, 30, tzinfo=ZoneInfo("UTC"))
print(moment.astimezone(ny).isoformat())

first = datetime(2026, 11, 1, 1, 30, tzinfo=ny, fold=0)
second = datetime(2026, 11, 1, 1, 30, tzinfo=ny, fold=1)
print(first.isoformat(), first.fold)
print(second.isoformat(), second.fold)
print(first == second)

Expected output

ZoneInfoNotFoundError
2026-11-21T10:30:00-05:00
2026-11-01T01:30:00-04:00 0
2026-11-01T01:30:00-05:00 1
True

Related: datetime (aware values and UTC), time (UTC timestamps)

Official documentation →