diff options
Diffstat (limited to 'src/corelib/tools/qdatetime.cpp')
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index dac1455d5c..ff96fbf811 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1583,12 +1583,12 @@ int QTime::msec() const Returns the time as a string. The \a format parameter determines the format of the string. - If \a format is Qt::TextDate, the string format is HH:MM:SS.zzz; - e.g. 1 second before midnight would be "23:59:59.000". + If \a format is Qt::TextDate, the string format is HH:MM:SS; + e.g. 1 second before midnight would be "23:59:59". If \a format is Qt::ISODate, the string format corresponds to the - ISO 8601 extended specification (with decimal fractions) for - representations of dates; also HH:MM:SS.zzz. + ISO 8601 extended specification for representations of dates, + which is also HH:MM:SS. If the \a format is Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the string format depends on the locale @@ -1636,10 +1636,9 @@ QString QTime::toString(Qt::DateFormat format) const case Qt::ISODate: case Qt::TextDate: default: - return QString::fromUtf8("%1:%2:%3.%4").arg(hour(), 2, 10, QLatin1Char('0')) - .arg(minute(), 2, 10, QLatin1Char('0')) - .arg(second(), 2, 10, QLatin1Char('0')) - .arg(msec(), 3, 10, QLatin1Char('0')); + return QString::fromUtf8("%1:%2:%3").arg(hour(), 2, 10, QLatin1Char('0')) + .arg(minute(), 2, 10, QLatin1Char('0')) + .arg(second(), 2, 10, QLatin1Char('0')); } } @@ -2729,15 +2728,15 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) and QTime::toString() are used to generate the string, so the day and month names will be localized names using the system locale, i.e. QLocale::system(). An example of this formatting is - "Wed May 20 03:40:13.456 1998". + "Wed May 20 03:40:13 1998". If the \a format is Qt::ISODate, the string format corresponds - to the ISO 8601 extended specification (with decimal fractions) for - representations of dates and times, taking the form - YYYY-MM-DDTHH:MM:SS.zzz[Z|[+|-]HH:MM], depending on the timeSpec() - of the QDateTime. If the timeSpec() is Qt::UTC, Z will be appended - to the string; if the timeSpec() is Qt::OffsetFromUTC, the offset - in hours and minutes from UTC will be appended to the string. + to the ISO 8601 extended specification for representations of + dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM], + depending on the timeSpec() of the QDateTime. If the timeSpec() + is Qt::UTC, Z will be appended to the string; if the timeSpec() is + Qt::OffsetFromUTC, the offset in hours and minutes from UTC will + be appended to the string. If the \a format is Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the string format depends on the locale |