PythonQt.QtCore.QTimeZone
QTimeZone
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
This class provides a stateless calculator for time zone conversions between UTC and the local time in a specific time zone. By default it uses the host system time zone data to perform these conversions.
This class is primarily designed for use in QDateTime; most applications will not need to access this class directly and should instead use QDateTime with a Qt::TimeSpec of Qt::TimeZone.
Note: For consistency with QDateTime, QTimeZone does not account for leap seconds.
Remarks
IANA Time Zone IDs
QTimeZone uses the IANA time zone IDs as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). This is to ensure a standard ID across all supported platforms. Most platforms support the IANA IDs and the IANA Database natively, but for Windows a mapping is required to the native IDs. See below for more details.
The IANA IDs can and do change on a regular basis, and can vary depending on how recently the host system data was updated. As such you cannot rely on any given ID existing on any host system. You must use availableTimeZoneIds() to determine what IANA IDs are available.
The IANA IDs and database are also know as the Olson IDs and database, named after their creator.
UTC Offset Time Zones
A default UTC time zone backend is provided which is always guaranteed to be available. This provides a set of generic Offset From UTC time zones in the range UTC-14:00 to UTC+14:00. These time zones can be created using either the standard ISO format names "UTC+00:00" as listed by availableTimeZoneIds(), or using the number of offset seconds.
Windows Time Zones
Windows native time zone support is severely limited compared to the standard IANA TZ Database. Windows time zones cover larger geographic areas and are thus less accurate in their conversions. They also do not support as much historic conversion data and so may only be accurate for the current year.
QTimeZone uses a conversion table derived form the Unicode CLDR data to map between IANA IDs and Windows IDs. Depending on your version of Windows and Qt, this table may not be able to provide a valid conversion, in which "UTC" will be returned.
QTimeZone provides a public API to use this conversion table. The Windows ID used is the Windows Registry Key for the time zone which is also the MS Exchange EWS ID as well, but is different to the Time Zone Name (TZID) and COD code used by MS Exchange in versions before 2007.
System Time Zone
QTimeZone does not support any concept of a system or default time zone. If you require a QDateTime that uses the current system time zone at any given moment then you should use a Qt::TimeSpec of Qt::LocalTime.
The method systemTimeZoneId() returns the current system IANA time zone ID which on Unix-like systems will always be correct. On Windows this ID is translated from the Windows system ID using an internal translation table and the user's selected country. As a consequence there is a small chance any Windows install may have IDs not known by Qt, in which case "UTC" will be returned.
Creating a new QTimeZone instance using the system time zone ID will only produce a fixed named copy of the time zone, it will not change if the system time zone changes.
Time Zone Offsets
The difference between UTC and the local time in a time zone is expressed as an offset in seconds from UTC, i.e. the number of seconds to add to UTC to obtain the local time. The total offset is comprised of two component parts, the standard time offset and the daylight-saving time offset. The standard time offset is the number of seconds to add to UTC to obtain standard time in the time zone. The daylight-saving time offset is the number of seconds to add to the standard time offset to obtain daylight-saving time (abbreviated DST and sometimes called "daylight time" or "summer time") in the time zone.
Note that the standard and DST offsets for a time zone may change over time as countries have changed DST laws or even their standard time offset.
License
This class includes data obtained from the CLDR data files under the terms of the Unicode Data Files and Software License. See Unicode Common Locale Data Repository (CLDR) for details.
Source: https://doc.qt.io/archives/qt-5.15/qtimezone.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
DaylightTime |
attribute | Any |
|
DefaultName |
attribute | Any |
|
GenericTime |
attribute | Any |
|
LongName |
attribute | Any |
|
NameType |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
OffsetName |
attribute | Any |
|
ShortName |
attribute | Any |
|
StandardTime |
attribute | Any |
|
TimeType |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
abbreviation |
function | (self, atDateTime: Any) -> str |
X.abbreviation(atDateTime) -> str |
availableTimeZoneIds |
function | (self, country: Any) -> Any |
Returns a list of all available IANA time zone IDs on this system. |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
comment |
function | (self) -> str |
X.comment() -> str |
country |
function | (self) -> Any |
Returns the country for the time zone. |
daylightTimeOffset |
function | (self, atDateTime: Any) -> int |
X.daylightTimeOffset(atDateTime) -> int |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
displayName |
function | (self, timeType: Any, nameType: Any, locale: Any) -> str |
X.displayName(timeType, nameType, locale) -> str |
hasDaylightTime |
function | (self) -> bool |
X.hasDaylightTime() -> bool |
hasTransitions |
function | (self) -> bool |
X.hasTransitions() -> bool |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
ianaIdToWindowsId |
function | (self, ianaId: Any) -> Any |
X.ianaIdToWindowsId(ianaId) -> PythonQt.QtCore.QByteArray |
id |
function | (self) -> Any |
X.id() -> PythonQt.QtCore.QByteArray |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
isDaylightTime |
function | (self, atDateTime: Any) -> bool |
X.isDaylightTime(atDateTime) -> bool |
isTimeZoneIdAvailable |
function | (self, ianaId: Any) -> bool |
X.isTimeZoneIdAvailable(ianaId) -> bool |
isValid |
function | (self) -> bool |
X.isValid() -> bool |
offsetFromUtc |
function | (self, atDateTime: Any) -> int |
X.offsetFromUtc(atDateTime) -> int |
operator_assign |
function | (self, other: Any) -> Any |
X.operator_assign(other) -> PythonQt.QtCore.QTimeZone |
readFrom |
function | (self, ds: Any) -> Any |
|
standardTimeOffset |
function | (self, atDateTime: Any) -> int |
X.standardTimeOffset(atDateTime) -> int |
swap |
function | (self, other: Any) -> None |
Swaps this time zone instance with other. |
systemTimeZone |
function | (self) -> Any |
X.systemTimeZone() -> PythonQt.QtCore.QTimeZone |
systemTimeZoneId |
function | (self) -> Any |
X.systemTimeZoneId() -> PythonQt.QtCore.QByteArray |
utc |
function | (self) -> Any |
X.utc() -> PythonQt.QtCore.QTimeZone |
windowsIdToDefaultIanaId |
function | (self, windowsId: Any, country: Any) -> Any |
X.windowsIdToDefaultIanaId(windowsId, country) -> PythonQt.QtCore.QByteArray |
windowsIdToIanaIds |
function | (self, windowsId: Any, country: Any) -> Any |
X.windowsIdToIanaIds(windowsId, country) |
writeTo |
function | (self, ds: Any) -> Any |