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

QDateTime::fromString is not able to parse spaced formats

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.2.0, 6.7
    • Core: Date/Time
    • None

    Description

      I just found a case where QDateTime::fromString() fails to parse date and time formats that use spaces for padding. For example "Feb 3 2014 15:15:12" can not be parsed by QDateTime (please not the padded space before the day). This format is returned e.g. by __DATE__ macro (as provided by VC++) so it is actually used.

      Please add an option to QDateTime::fromString() that allows specifying such a format or make the options that accept leading zeros more flexible by also accepting leading spaces.

      (Clarification: in the given string, "Feb 3 …" has two spaces between Feb and 3, the second of which is the padding of 3 to fill a two-digit field. QDateTime::fromString() supports two-digit fields but expects single digit values in them to be zero-padded, not space-padded.)

      Attachments

        Issue Links

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

          Activity

            People

              Eddy Edward Welbourne
              silicomancer Bernhard Lindner
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes