This is a tzinfo object that represents the UTC time zone.
Fast track version of fromutc() returns the original dt object for any valid datetime.datetime object.
Whether or not the “wall time” of a given datetime is ambiguous in this zone.
Parameters: | dt – A datetime.datetime, naive or time zone aware. |
---|---|
Returns: | Returns True if ambiguous, False otherwise. |
New in version 2.6.0.
A simple class for representing a fixed offset from UTC.
Parameters: |
|
---|
Whether or not the “wall time” of a given datetime is ambiguous in this zone.
Parameters: | dt – A datetime.datetime, naive or time zone aware. |
---|---|
Returns: | Returns True if ambiguous, False otherwise. |
New in version 2.6.0.
A tzinfo subclass built around the time timezone functions.
Whether or not the “wall time” of a given datetime is ambiguous in this zone.
Parameters: | dt – A datetime.datetime, naive or time zone aware. |
---|---|
Returns: | Returns True if ambiguous, False otherwise. |
New in version 2.6.0.
This is a tzinfo subclass thant allows one to use the tzfile(5) format timezone files to extract current and historical zone information.
Parameters: |
|
---|
See Sources for Time Zone and Daylight Saving Time Data for more information. Time zone files can be compiled from the IANA Time Zone database files with the zic time zone compiler
The tzfile implementation of datetime.tzinfo.fromutc().
Parameters: | dt – A datetime.datetime object. |
---|---|
Raises: |
|
Returns: | Returns a datetime.datetime object representing the wall time in self‘s time zone. |
Whether or not the “wall time” of a given datetime is ambiguous in this zone.
Parameters: | dt – A datetime.datetime, naive or time zone aware. |
---|---|
Returns: | Returns True if ambiguous, False otherwise. |
New in version 2.6.0.
The tzrange object is a time zone specified by a set of offsets and abbreviations, equivalent to the way the TZ variable can be specified in POSIX-like systems, but using Python delta objects to specify DST start, end and offsets.
Parameters: |
|
---|
Examples:
>>> tzstr('EST5EDT') == tzrange("EST", -18000, "EDT")
True
>>> from dateutil.relativedelta import *
>>> range1 = tzrange("EST", -18000, "EDT")
>>> range2 = tzrange("EST", -18000, "EDT", -14400,
... relativedelta(hours=+2, month=4, day=1,
... weekday=SU(+1)),
... relativedelta(hours=+1, month=10, day=31,
... weekday=SU(-1)))
>>> tzstr('EST5EDT') == range1 == range2
True
For a given year, get the DST on and off transition times, expressed always on the standard time side. For zones with no transitions, this function returns None.
Parameters: | year – The year whose transitions you would like to query. |
---|---|
Returns: | Returns a tuple of datetime.datetime objects, (dston, dstoff) for zones with an annual DST transition, or None for fixed offset zones. |
tzstr objects are time zone objects specified by a time-zone string as it would be passed to a TZ variable on POSIX-style systems (see the GNU C Library: TZ Variable for more details).
There is one notable exception, which is that POSIX-style time zones use an inverted offset format, so normally GMT+3 would be parsed as an offset 3 hours behind GMT. The tzstr time zone object will parse this as an offset 3 hours ahead of GMT. If you would like to maintain the POSIX behavior, pass a True value to posix_offset.
The tzrange object provides the same functionality, but is specified using relativedelta.relativedelta objects. rather than strings.
Parameters: |
|
---|
This object is designed to parse an iCalendar-style VTIMEZONE structure as set out in RFC 2445 Section 4.6.5 into one or more tzinfo objects.
Parameters: | fileobj – A file or stream in iCalendar format, which should be UTF-8 encoded with CRLF endings. |
---|
Retrieve a datetime.tzinfo object by its tzid.
Parameters: | tzid – If there is exactly one time zone available, omitting tzid or passing None value returns it. Otherwise a valid key (which can be retrieved from keys()) is required. |
---|---|
Raises ValueError: | |
Raised if tzid is not specified but there are either more or fewer than 1 zone defined. | |
Returns: | Returns either a datetime.tzinfo object representing the relevant time zone or None if the tzid was not found. |
Retrieves the available time zones as a list.
Provides a unified interface for assigning the fold attribute to datetimes both before and after the implementation of PEP-495.
Parameters: | fold – The value for the fold attribute in the returned datetime. This should be either 0 or 1. |
---|---|
Returns: | Returns an object for which getattr(dt, 'fold', 0) returns fold for all versions of Python. In versions prior to Python 3.6, this is a _DatetimeWithFold object, which is a subclass of datetime.datetime with the fold attribute added, if fold is 1. |
New in version 2.6.0.
Given a datetime and a time zone, determine whether or not a given datetime is ambiguous (i.e if there are two times differentiated only by their DST status).
Parameters: |
|
---|---|
Returns: | Returns a boolean value whether or not the “wall time” is ambiguous in tz. |
New in version 2.6.0.
Given a datetime and a time zone, determine whether or not a given datetime would fall in a gap.
Parameters: |
|
---|---|
Returns: | Returns a boolean value whether or not the “wall time” exists in tz. |