pytz
World timezone definitions, modern and historical
Decision gist · record as of 2026-08-14
Yes, if you need to support Python versions before 3.9 or maintain existing code that already uses pytz. No, if you are starting a new project on Python 3.9+—use the standard library zoneinfo module with tzdata instead. The package is actively maintained and has no known vulnerabilities, but its non-standard API and the availability of a superior standard library alternative make it a legacy choice for new development.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires use of localize() method for naive datetimes rather than the standard tzinfo constructor argument; direct tzinfo= assignment produces incorrect results for most timezones.
- Date arithmetic across DST boundaries requires normalize() to correct timezone after operations.
- Low install friction with no runtime dependencies.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) imposes no significant restrictions on use, modification, or distribution in commercial or private projects.
last release 2026-07-25 (20 days) · last repo commit 2026-07-25 · 393 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 551,686,335 downloads/mo, #66 on PyPI
Alternatives
Verify before relying
pip install pytz
from datetime import datetime
from pytz import timezone
eastern = timezone('US/Eastern')
loc_dt = eastern.localize(datetime(2002, 10, 27, 6, 0, 0))
print(loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'))- Whether pytz remains actively maintained for new Olson database updates or if maintenance is primarily for backwards compatibility
- Performance characteristics when handling large volumes of timezone conversions or historical timezone data queries
What it is and what it does
pytz is a timezone library that brings the Olson timezone database into Python, allowing you to work with real-world timezone definitions including historical changes and daylight saving time rules. It provides timezone objects you can use to localize naive datetime objects or convert between timezones using the astimezone() method.
The library solves the core problem of ambiguous times during DST transitions and handles timezone arithmetic correctly. However, it has a non-standard API: you must use its localize() method to attach timezone info to naive datetimes rather than passing tzinfo directly to the datetime constructor, and you need to call normalize() after arithmetic on local times that cross DST boundaries. The package itself recommends that projects using Python 3.9 or later use the standard library zoneinfo module with tzdata instead, since pytz offers no advantages beyond backwards compatibility with older code.
Use it for
- Converting UTC timestamps to local times in different timezones for display to users in different regions
- Handling ambiguous times during daylight saving time transitions by explicitly specifying is_dst parameter
- Performing date arithmetic on local times while correctly accounting for DST boundary changes
- Building applications that must support historical timezone definitions and past DST rules
- Maintaining legacy codebases that depend on pytz before migration to zoneinfo is feasible
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to support Python versions before 3.9 or maintain existing code that already uses pytz.
No, if you are starting a new project on Python 3.9+—use the standard library zoneinfo module with tzdata instead. The package is actively maintained and has no known vulnerabilities, but its non-standard API and the availability of a superior standard library alternative make it a legacy choice for new development.
Install
pytz on PyPI
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 2026-07-25 with recent releases; however, the package itself notes that Python 3.9+ users should prefer the standard library zoneinfo module with tzdata package instead.
Requires use of localize() method for naive datetimes rather than the standard tzinfo constructor argument; direct tzinfo= assignment produces incorrect results for most timezones. Date arithmetic across DST boundaries requires normalize() to correct timezone after operations.
License in practice
MIT license (permissive) imposes no significant restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install pytz
from datetime import datetime
from pytz import timezone
eastern = timezone('US/Eastern')
loc_dt = eastern.localize(datetime(2002, 10, 27, 6, 0, 0))
print(loc_dt.strftime('%Y-%m-%d %H:%M:%S %Z%z'))
Verify before relying
- Whether pytz remains actively maintained for new Olson database updates or if maintenance is primarily for backwards compatibility
- Performance characteristics when handling large volumes of timezone conversions or historical timezone data queries
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 20 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 551,686,335 / month, #66 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.4Programming Language :: Python :: 2.5Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: pytz-2026.3.post1-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “timezone handling python”
- pytzpytz brings the Olson timezone database into Python, enabling…
- backports.zoneinfoProvides IANA time zone support for Python 3.6–3.8 by backporting the…
- SQLAlchemy-UtcProvides a SQLAlchemy DateTime type that consistently handles…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also backports.zoneinfo · django-timezone-field · pendulum · pytz-deprecation-shim · times · tzlocal · DateTime · pytzdata · whenever · tzfpy