zoneinfo

Submodules

Package Contents

Classes

tzfile()
ZoneInfoFile(self,zonefile_stream=None)

Functions

getzoneinfofile_stream()
get_zonefile_instance(new_instance=False) This is a convenience function which provides a ZoneInfoFile
gettz(name) This retrieves a time zone from the local zoneinfo tarball that is packaged
gettz_db_metadata() Get the zonefile metadata
class tzfile
__reduce__()
getzoneinfofile_stream()
class ZoneInfoFile(zonefile_stream=None)
__init__(zonefile_stream=None)
get(name, default=None)

Wrapper for ZoneInfoFile.zones.get(). This is a convenience method for retrieving zones from the zone dictionary.

Parameters:
  • name – The name of the zone to retrieve. (Generally IANA zone names)
  • default – The value to return in the event of a missing key.

New in version 2.6.0.

get_zonefile_instance(new_instance=False)

This is a convenience function which provides a ZoneInfoFile instance using the data provided by the dateutil package. By default, it caches a single instance of the ZoneInfoFile object and returns that.

Parameters:new_instance – If True, a new instance of ZoneInfoFile is instantiated and used as the cached instance for the next call. Otherwise, new instances are created only as necessary.
Returns:Returns a ZoneInfoFile object.

New in version 2.6.

gettz(name)

This retrieves a time zone from the local zoneinfo tarball that is packaged with dateutil.

Parameters:name – An IANA-style time zone name, as found in the zoneinfo file.
Returns:Returns a dateutil.tz.tzfile time zone object.

Warning

It is generally inadvisable to use this function, and it is only provided for API compatibility with earlier versions. This is not equivalent to dateutil.tz.gettz(), which selects an appropriate time zone based on the inputs, favoring system zoneinfo. This is ONLY for accessing the dateutil-specific zoneinfo (which may be out of date compared to the system zoneinfo).

Deprecated since version 2.6: If you need to use a specific zoneinfofile over the system zoneinfo, instantiate a dateutil.zoneinfo.ZoneInfoFile object and call dateutil.zoneinfo.ZoneInfoFile.get(name)() instead.

Use get_zonefile_instance() to retrieve an instance of the dateutil-provided zoneinfo.

gettz_db_metadata()

Get the zonefile metadata

See `zonefile_metadata`_

Returns:A dictionary with the database metadata

Deprecated since version 2.6: See deprecation warning in zoneinfo.gettz(). To get metadata, query the attribute zoneinfo.ZoneInfoFile.metadata.