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

Conversion to time-spec Qt::OffsetFromUTC could productively use current offset

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14
    • Core: Date/Time
    • None
    • All

    Description

      QDateTime::toString()'s documentation tells the user that Qt::ISODate's handling depends on spec but neglects to mention how to change the date-time the caller has to the spec that'll give them the format they want. (Report originates with vestbo wanting the format that Qt::OffsetFromUTC provides, but having a local-time.)
      The diligent reader may manage to find toTimeSpec(), but using it with Qt::OffsetFromUTC doesn't do what a reasonable client would want - which they can do, but only by calling

        t.toOffsetFromUtc(t.offsetFromUtc())
      

      which is something of a hurdle for them to work out.
      The toString() doc should at least be updated to explain how to do this correctly, if only by reference to toTimeSpec(). The doc of toTimeSpec() should also mention toTimeZone().

      The situation could be improved by having toOffsetFromUtc() with no argument use the instance's current offsetFromUtc(); and/or by having toTimeSpec(Qt::OffsetFromUTC) do likewise. The latter would be a behaviour change, but could perhaps be done at Qt 6.

      Attachments

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

        Activity

          People

            docteam Qt Documentation Team
            Eddy Edward Welbourne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes