Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7898

"QLocale::toDateTime ( const QString & string, FormatType format = LongFormat ) const" cannot return correct value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • Some future release
    • 4.6.1
    • Core: Locales (i18n)
    • None
    • Ubuntu 9.04 with Qt4.6.1

    Description

      the following code shows the issue:

      QLocale locale = QLocale(QLocale::English);
      //QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM"); // with no blank space char after "AM", this date time str cannot be parsed correctly
      QString dateTimeStr = QString("Monday, January 5, 2009 11:48:32 AM ");
       
      //QDateTime value = locale.toDateTime(dateTimeStr , locale.dateTimeFormat(QLocale::LongFormat)); // this will success
      QDateTime value = locale.toDateTime(dateTimeStr , QLocale::LongFormat); // cannot return right QDateTime value
      

      souce code of "toDateTime"

      QDateTime QLocale::toDateTime(const QString &string, FormatType format) const
      {
          return toDateTime(string, dateFormat(format)); // "dateFormat" should be replaced by "dateTimeFormat"
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              laknoll Lars Knoll
              suuuushe Shenghua Su (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes