Olson Timezone Database for Python

2020.1 · maintenance · verified Sun Mar 29

pytzdata is a Python library that provides access to the IANA/Olson timezone database files. It packages a snapshot of this database, allowing applications to retrieve raw timezone definitions. The current version, 2020.1, was released in July 2020. The project does not appear to follow a regular release cadence and is effectively in maintenance mode, largely superseded by the standard library `zoneinfo` module in Python 3.9+ and the `tzdata` package.

Warnings

Install

Imports

Quickstart

Demonstrates how to retrieve the file path for a timezone or access its raw content using `tz_path` and `tz_file`.

from pytzdata import tz_path

# Get the path to a specific timezone file
paris_tz_path = tz_path('Europe/Paris')
print(f"Path to Europe/Paris timezone data: {paris_tz_path}")

from pytzdata import tz_file

# Access the content of a specific timezone file
with tz_file('America/New_York') as f:
    content_start = f.read(50)
    print(f"First 50 bytes of America/New_York data: {content_start}...")

view raw JSON →