class documentation

This is a ``tzinfo`` subclass that allows one to use the ``tzfile(5)`` format timezone files to extract current and historical zone information. :param fileobj: This can be an opened file stream or a file name that the time zone information can be read from. :param filename: This is an optional parameter specifying the source of the time zone information in the event that ``fileobj`` is a file object. If omitted and ``fileobj`` is a file stream, this parameter will be set either to ``fileobj``'s ``name`` attribute or to ``repr(fileobj)``. See `Sources for Time Zone and Daylight Saving Time Data <https://data.iana.org/time-zones/tz-link.html>`_ for more information. Time zone files can be compiled from the `IANA Time Zone database files <https://www.iana.org/time-zones>`_ with the `zic time zone compiler <https://www.freebsd.org/cgi/man.cgi?query=zic&sektion=8>`_ .. note:: Only construct a ``tzfile`` directly if you have a specific timezone file on disk that you want to read into a Python ``tzinfo`` object. If you want to get a ``tzfile`` representing a specific IANA zone, (e.g. ``'America/New_York'``), you should call :func:`dateutil.tz.gettz` with the zone identifier. **Examples:** Using the US Eastern time zone as an example, we can see that a ``tzfile`` provides time zone information for the standard Daylight Saving offsets: .. testsetup:: tzfile from dateutil.tz import gettz from datetime import datetime .. doctest:: tzfile >>> NYC = gettz('America/New_York') >>> NYC tzfile('/usr/share/zoneinfo/America/New_York') >>> print(datetime(2016, 1, 3, tzinfo=NYC)) # EST 2016-01-03 00:00:00-05:00 >>> print(datetime(2016, 7, 7, tzinfo=NYC)) # EDT 2016-07-07 00:00:00-04:00 The ``tzfile`` structure contains a fully history of the time zone, so historical dates will also have the right offsets. For example, before the adoption of the UTC standards, New York used local solar mean time: .. doctest:: tzfile >>> print(datetime(1901, 4, 12, tzinfo=NYC)) # LMT 1901-04-12 00:00:00-04:56 And during World War II, New York was on "Eastern War Time", which was a state of permanent daylight saving time: .. doctest:: tzfile >>> print(datetime(1944, 2, 7, tzinfo=NYC)) # EWT 1944-02-07 00:00:00-04:00

Method __eq__ Undocumented
Method __init__ Undocumented
Method __ne__ Undocumented
Method __reduce__ Undocumented
Method __reduce_ex__ Undocumented
Method __repr__ Undocumented
Method dst Undocumented
Method fromutc The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`.
Method is_ambiguous Whether or not the "wall time" of a given datetime is ambiguous in this zone.
Method tzname Undocumented
Method utcoffset Undocumented
Class Variable __hash__ Undocumented
Method _find_last_transition Undocumented
Method _find_ttinfo Undocumented
Method _get_ttinfo Undocumented
Method _read_tzfile Undocumented
Method _resolve_ambiguous_time Undocumented
Method _set_tzdata Set the time zone data of this object from a _tzfile object
Instance Variable _filename Undocumented

Inherited from _tzinfo:

Method _fold Undocumented
Method _fold_status Determine the fold status of a "wall" datetime, given a representation of the same datetime as a (naive) UTC datetime. This is calculated based on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all datetimes, and that this offset is the actual number of hours separating ``dt_utc`` and ``dt_wall``.
Method _fromutc Given a timezone-aware datetime in a given timezone, calculates a timezone-aware datetime in a new timezone.
def __eq__(self, other): (source)

Undocumented

def __init__(self, fileobj, filename=None): (source)

Undocumented

def __ne__(self, other): (source)

Undocumented

def __reduce__(self): (source)

Undocumented

def __reduce_ex__(self, protocol): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def dst(self, dt): (source)

Undocumented

def fromutc(self, dt): (source)

The ``tzfile`` implementation of :py:func:`datetime.tzinfo.fromutc`. :param dt: A :py:class:`datetime.datetime` object. :raises TypeError: Raised if ``dt`` is not a :py:class:`datetime.datetime` object. :raises ValueError: Raised if this is called with a ``dt`` which does not have this ``tzinfo`` attached. :return: Returns a :py:class:`datetime.datetime` object representing the wall time in ``self``'s time zone.

def is_ambiguous(self, dt, idx=None): (source)

Whether or not the "wall time" of a given datetime is ambiguous in this zone. :param dt: A :py:class:`datetime.datetime`, naive or time zone aware. :return: Returns ``True`` if ambiguous, ``False`` otherwise. .. versionadded:: 2.6.0

@tzname_in_python2
def tzname(self, dt): (source)

Undocumented

def utcoffset(self, dt): (source)

Undocumented

__hash__ = (source)

Undocumented

def _find_last_transition(self, dt, in_utc=False): (source)

Undocumented

def _find_ttinfo(self, dt): (source)

Undocumented

def _get_ttinfo(self, idx): (source)

Undocumented

def _read_tzfile(self, fileobj): (source)

Undocumented

def _resolve_ambiguous_time(self, dt): (source)

Undocumented

def _set_tzdata(self, tzobj): (source)

Set the time zone data of this object from a _tzfile object

_filename = (source)

Undocumented