tz.win

This module provides an interface to the native time zone data on Windows,includingdatetime.tzinfo implementations.

Attempting to import this module on a non-Windows platform will raise anImportError.

Classes

classdateutil.tz.win.tzres(tzres_loc='tzres.dll')[source]

Class for accessingtzres.dll, which contains timezone name relatedresources.

New in version 2.5.0.

load_name(offset)[source]

Load a timezone name from a DLL offset (integer).

>>>fromdateutil.tzwinimporttzres>>>tzr=tzres()>>>print(tzr.load_name(112))'Eastern Standard Time'
Parameters:

offset – A positive integer value referring to a string from the tzres dll.

Note

Offsets found in the registry are generally of the form@tzres.dll,-114. The offset in this case is 114, not -114.

name_from_string(tzname_str)[source]

Parse strings as returned from the Windows registry into the time zonename as defined in the registry.

>>>fromdateutil.tzwinimporttzres>>>tzr=tzres()>>>print(tzr.name_from_string('@tzres.dll,-251'))'Dateline Daylight Time'>>>print(tzr.name_from_string('Eastern Standard Time'))'Eastern Standard Time'
Parameters:

tzname_str – A timezone name string as returned from a Windows registry key.

Returns:

Returns the localized timezone string from tzres.dll if the stringis of the form@tzres.dll,-offset, else returns the input string.

classdateutil.tz.win.tzwin(name)[source]

Time zone object created from the zone info in the Windows registry

These are similar todateutil.tz.tzrange objects in thatthe time zone data is provided in the format of a single offset rulefor either 0 or 2 time zone transitions per year.

Param:

nameThe name of a Windows time zone key, e.g. “Eastern Standard Time”.The full list of keys can be retrieved withtzwin.list().

display()

Return the display name of the time zone.

staticlist()

Return a list of all time zones known to the system.

transitions(year)

For a given year, get the DST on and off transition times, expressedalways on the standard time side. For zones with no transitions, thisfunction returnsNone.

Parameters:

year – The year whose transitions you would like to query.

Returns:

Returns atuple ofdatetime.datetime objects,(dston,dstoff) for zones with an annual DST transition, orNone for fixed offset zones.

classdateutil.tz.win.tzwinlocal[source]

Class representing the local time zone information in the Windows registry

Whiledateutil.tz.tzlocal makes system calls (via thetimemodule) to retrieve time zone information,tzwinlocal retrieves therules directly from the Windows registry and creates an object likedateutil.tz.tzwin.

Because Windows does not have an equivalent oftime.tzset(), onWindows,dateutil.tz.tzlocal instances will always reflect thetime zone settingsat the time that the process was started, meaningchanges to the machine’s time zone settings during the run of a programon Windows willnot be reflected bydateutil.tz.tzlocal.Becausetzwinlocal reads the registry directly, it is unaffected bythis issue.

display()

Return the display name of the time zone.

transitions(year)

For a given year, get the DST on and off transition times, expressedalways on the standard time side. For zones with no transitions, thisfunction returnsNone.

Parameters:

year – The year whose transitions you would like to query.

Returns:

Returns atuple ofdatetime.datetime objects,(dston,dstoff) for zones with an annual DST transition, orNone for fixed offset zones.