diff options
author | Liang Qi <liang.qi@nokia.com> | 2010-07-05 14:42:44 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2010-07-05 14:42:44 (GMT) |
commit | 8ef60f0791c1fb7fa649214238db6db3e2d975c6 (patch) | |
tree | c002f908f2a2ac66d20d3f45aba7d5605d656ea6 /src | |
parent | 752d46c90ee0fc5f06f01feedd8e0659178b15d4 (diff) | |
download | Qt-8ef60f0791c1fb7fa649214238db6db3e2d975c6.zip Qt-8ef60f0791c1fb7fa649214238db6db3e2d975c6.tar.gz Qt-8ef60f0791c1fb7fa649214238db6db3e2d975c6.tar.bz2 |
Revert "Support time zone designator in QDateTime::fromString() based on ISO 8601-2004 standard."
This reverts commit 752d46c90ee0fc5f06f01feedd8e0659178b15d4.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 5 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 27 |
2 files changed, 3 insertions, 29 deletions
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 15c4efc..a756565 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -577,9 +577,8 @@ be short, localized names. This is basically equivalent to using the date format string, "ddd MMM d yyyy". See QDate::toString() for more information. - \value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or - \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00) - for combined dates and times. + \value ISODate ISO 8601 extended format: either \c{YYYY-MM-DD} for dates or + \c{YYYY-MM-DDTHH:MM:SS} for combined dates and times. \value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used by the \l{QLocale::system()}{operating system}. diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c6ab4e4..347de0c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3044,37 +3044,12 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) if (tmp.size() == 10) return QDateTime(date); - tmp = tmp.mid(11); - // Recognize UTC specifications if (tmp.endsWith(QLatin1Char('Z'))) { ts = Qt::UTC; tmp.chop(1); } - - // Recognize timezone specifications - QRegExp rx(QLatin1String("[+-]")); - if (tmp.contains(rx)) { - int idx = tmp.indexOf(rx); - QString tmp2 = tmp.mid(idx); - tmp = tmp.left(idx); - bool ok = true; - int ntzhour = 1; - int ntzminute = 3; - if ( tmp2.indexOf(QLatin1Char(':')) == 3 ) - ntzminute = 4; - const int tzhour(tmp2.mid(ntzhour, 2).toInt(&ok)); - const int tzminute(tmp2.mid(ntzminute, 2).toInt(&ok)); - QTime tzt(tzhour, tzminute); - int utcOffset = (tzt.hour() * 60 + tzt.minute()) * 60; - if ( utcOffset != 0 ) { - ts = Qt::OffsetFromUTC; - QDateTime dt(date, QTime::fromString(tmp, Qt::ISODate), ts); - dt.setUtcOffset( utcOffset * (tmp2.startsWith(QLatin1Char('-')) ? -1 : 1) ); - return dt; - } - } - return QDateTime(date, QTime::fromString(tmp, Qt::ISODate), ts); + return QDateTime(date, QTime::fromString(tmp.mid(11), Qt::ISODate), ts); } case Qt::SystemLocaleDate: case Qt::SystemLocaleShortDate: |