PyDocs

Nav

Data Types

ZoneInfo

zoneinfo

classnot WASI
  • ZoneInfo(key)
A concrete datetime.tzinfo subclass that represents an IANA time zone specified by the string key. Calls to the primary constructor will always return objects that compare identically; put another way, barring cache invalidation via ZoneInfo.clear_cache(), for all values of key, the following assertion will always be true:
Members of ZoneInfo

c

clear_cache
A method for invalidating the cache on the ZoneInfo class.

f

from_file
Constructs a ZoneInfo object from a file-like object returning bytes (e.g.

k

key
This is a read-only attribute that returns the value of key passed to the constructor, which should be a lookup key in the IANA time zone database (e.g.

n

no_cache
An alternate constructor that bypasses the constructor’s cache.
1 Example
>>> from zoneinfo import ZoneInfo
>>> import datetime as dt

>>> when = dt.datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(when)
2020-10-31 12:00:00-07:00

>>> when.tzname()
'PDT'
from the Python docs
See Also
No see-alsos for zoneinfo/ZoneInfo
0 Notes
No notes for ZoneInfo