win32api.GetTimeZoneInformation
tuple = GetTimeZoneInformation(times_as_tuples)
Retrieves the system time-zone information.
Parameters
times_as_tuples=? : bool
If true, the SYSTEMTIME elements are returned as tuples instead of a time
object. Defaults to False on 3.5 and earlier, True otherwise, because this function
returns SYSTEMTIME information with members which datetime on 3.6 and later treats as
invalid. In other words, using False on 3.6 and later will result in ValueErrors
instead of returning.
Return Value
The return value is a tuple of (rc, tzinfo), where rc is
the integer return code from ::GetTimezoneInformation(), which may be
value
|
description
|
|
|
TIME_ZONE_ID_STANDARD | if in standard time |
TIME_ZONE_ID_DAYLIGHT | if in daylight savings time |
TIME_ZONE_ID_UNKNOWN | if the timezone in question doesn't use daylight savings time, (eg. indiana time). |
tzinfo is a tuple of:
Items
- [0] int : bias
- Specifies the current bias, in minutes, for local time translation on this computer. The
bias is the difference, in minutes, between Coordinated Universal Time (UTC) and local time. All translations
between UTC and local time are based on the following formula:
UTC = local time + bias
- [1] unicode : standardName
- Specifies a string associated with standard time on this operating system. For
example, this member could contain "EST" to indicate Eastern Standard Time. This string is not used by the
operating system, so anything stored there using the SetTimeZoneInformation function is returned unchanged by the
GetTimeZoneInformation function. This string can be empty.
- [2] PyDateTime/tuple : standardTime
- Specifies a SYSTEMTIME object that contains a date and local time when
the transition from daylight saving time to standard time occurs on this operating system. If this date is not
specified, the wMonth member in the SYSTEMTIME structure must be zero. If this date is specified, the
DaylightDate value in the TIME_ZONE_INFORMATION structure must also be specified.
To select the correct day
in the month, set the wYear member to zero, the wDayOfWeek member to an appropriate weekday, and the wDay member
to a value in the range 1 through 5. Using this notation, the first Sunday in April can be specified, as can the
last Thursday in October (5 is equal to "the last").
- [3] int : standardBias
- Specifies a bias value to be used during local time translations that occur during
standard time. This member is ignored if a value for the StandardDate member is not supplied.
This value is
added to the value of the Bias member to form the bias used during standard time. In most time zones, the value
of this member is zero.
- [4] unicode : daylightName
- [5] PyDateTime/tuple : daylightTime
- [6] int : daylightBias
- Specifies a bias value to be used during local time translations that occur during
daylight saving time. This member is ignored if a value for the DaylightDate member is not supplied.
This
value is added to the value of the Bias member to form the bias used during daylight saving time. In most time
zones, the value of this member is 60.