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

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

XMLWordPrintable

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

      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"
      }
      

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes