summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qdatetime.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-02-12 13:26:37 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2021-02-15 13:44:21 +0100
commit517578e0712732ad43f21b6a655ba5e70ada6ab7 (patch)
treef9b42b3cb43ca7c5a0090abf264169dec3445b79 /src/corelib/time/qdatetime.cpp
parent3cf84287e71d8698c46ce31a6daad71056db8027 (diff)
QDateTime::toString(): use UTC-offset as time-zone suffix
Since fromString() can't parse the (ambiguous at the best of times; also backend-dependent and thus potentially system-locale-dependent) abbreviations currently produced (since 5.9) and can parse UTC-based offsets, the OffsetName of the zone is a more robust format for the zone-suffix. This also makes it possible to consistently use the C locale, compatibly with everything else about post-6.0 date-time serialization. [ChangeLog][QtCore][QDateTime] When spec is Qt::TimeZone, the offset-suffix now used for the toString(Qt::TextDate) format is now a UTC-based offset string, compatible with the parsing (now) supported by fromString(). The zone-abbreviation suffix in use since 5.9 was not parseable. Change-Id: I4024ae87980c6d3590c68a67b8d1c8f433e36855 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/time/qdatetime.cpp')
-rw-r--r--src/corelib/time/qdatetime.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 28b3cbb059..ca3c8e5cc8 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -4029,7 +4029,8 @@ QString QDateTime::toString(Qt::DateFormat format) const
break;
#if QT_CONFIG(timezone)
case Qt::TimeZone:
- buf += u' ' + d->m_timeZone.abbreviation(*this);
+ buf += u' ' + d->m_timeZone.displayName(
+ *this, QTimeZone::OffsetName, QLocale::c());
break;
#endif
default: