--- id: tzlocal version: "5.4.4" license: MIT license_treatment: permissive maintenance: active --- # tzlocal — tzinfo object for the local timezone License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install tzlocal uv add tzlocal poetry add tzlocal ## Description tzlocal ======= API CHANGE! ----------- With version 3.0 of tzlocal, tzlocal no longer returned `pytz` objects, but `zoneinfo` objects, which has a different API. Since 4.0, it now restored partial compatibility for `pytz` users through Paul Ganssle's `pytz_deprecation_shim`. tzlocal 4.0 also adds an official function `get_localzone_name()` to get only the timezone name, instead of a timezone object. On unix, it can raise an error if you don't have a timezone name configured, where `get_localzone()` will succeed, so only use that if you need the timezone name. 4.0 also adds way more information on what is going wrong in your configuration when the configuration files are unclear or contradictory. Version 5.0 removes the `pytz_deprecation_shim`, and now only returns `zoneinfo` objects, like verion 3.0 did. If you need `pytz` objects, you have to stay on version 4.0. If there are bugs in version 4.0, I will release updates, but there will be no further functional changes on the 4.x branch. Info ---- This Python module returns the `IANA time zone name `_ for your local time zone or a ``tzinfo`` object with the local timezone information,... ## AI interpretation — verify before relying Retrieves the local system timezone as a `zoneinfo.ZoneInfo` object or IANA timezone name, handling platform-specific configuration across Windows and Unix systems. Verdict: Mature, actively maintained library (14 years, top 1000 PyPI) with zero known vulnerabilities. Clean MIT license and minimal dependencies make it a reliable choice for applications needing local timezone detection across Windows and Unix platforms. [View on SkillFed](https://skillfed.io/packages/tzlocal) · [View on PyPI](https://pypi.org/project/tzlocal/)