Skip to main content

pytzsub

CI PyPI version Python versions License: MIT

World timezone definitions by country subdivision (e.g., provinces or states).

Given an ISO 3166 country or subdivision code, pytzsub returns the matching IANA time zone name.

Accuracy of the database

The database is not authoritative, and it surely has errors. Corrections are welcome and encouraged.

Installation

As per usual:

pip install pytzsub

pytzsub has no runtime dependencies and supports Python 3.9+.

Examples

>>> from pytzsub import sub_timezone
>>> sub_timezone('US-CA')
'America/Los_Angeles'
>>> from pytzsub import all_code
>>> 'US-CA' in all_code()
True

Combine it with the standard-library zoneinfo module (Python 3.9+) to build a real timezone object:

>>> from zoneinfo import ZoneInfo
>>> from pytzsub import sub_timezone
>>> tz = ZoneInfo(sub_timezone('CA-QC'))
>>> tz.key
'America/Toronto'

It also works with pytz if you prefer it:

>>> from pytz import timezone
>>> from pytzsub import sub_timezone
>>> timezone(sub_timezone('CA-QC'))
<DstTzInfo 'America/Toronto' LMT-1 day, 18:28:00 STD>

Metadata

Release files for pytzsub 2026.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytzsub 2026.7
File Size Uploaded Provenance Actions
pytzsub-2026.7.tar.gz 9.3 kB Without provenance Details for pytzsub-2026.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytzsub 2026.7
File Interpreter ABI Platform Actions
pytzsub-2026.7-py3-none-any.whl Python 3 none any Details for pytzsub-2026.7-py3-none-any.whl

Total release size: 18.6 kB

Release files / pytzsub-2026.7.tar.gz

Download URL pytzsub-2026.7.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
66f6a7eb186440d098315d552f536b5e8af2b5b972080a4d0e105f29e270726e
BLAKE2b-256 checksum
How to use checksums
8ca97df30fcd4e86101ee6badac10181052e33ee7fe0a5fde9a241bf1fe11083
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pytzsub-2026.7-py3-none-any.whl

Download URL pytzsub-2026.7-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e6ce274c97eb6783be668c8c03326ba898f0ba62af1dd968ee6802b190c63f2
BLAKE2b-256 checksum
How to use checksums
201b57d3991c859f012822424c3d5bd4828c4a962f63ce6fc55fcc594e3ae95a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for pytzsub 2026.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page