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

Hours in Qt.formatTime doesn't work with Date(milliseconds)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.2.0
    • None
    • QtCreator 3.0.0, Qt 5.2.0, Windows Seven 64bits

    Description

      See the code below for the error.
      I build a javascript Date with 3600000 milliseconds (http://www.w3schools.com/jsref/jsref_obj_date.asp)
      Then I get the hour with formatTime. It returns 2h00 and not 1h00.

      If I set the Date with 3600 milliseconds, formatTime returns 1h00 (I guess that there is a mistake between seconds and milliseconds in the format)

      import QtQuick 2.0
      
      Rectangle {
          width: 360
          height: 360
          function f()
          {
              var d = new Date(3600000);
              console.log(d.getTime());
              return Qt.formatTime(d, "h'h'mm") // return 2h00
          }
          Text {
              text : f()
              anchors.centerIn: parent
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            julienw Julien W
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes