[Solved] QTime::fromString() not working



  • I have time in a string object.

    @QString strTime = "13:20:15";@

    now I want to store this as Qtime but it is not working. I am translating it like following

    @QString time;
    time.fromString( strTime, "hh':'mm':'ss" );@

    And tried this as well.
    @time.fromString( strTime, "hh:mm:ss" );@

    But my time value shows invalid. What am I possibly doing wrong here?


  • Lifetime Qt Champion

    Hi,

    Your time format is wrong and fromString is a static function belonging to QTime and not QString

    @
    QString strTime = "13:20:15";
    QTime time = QTime::fromString( strTime, "hh:mm:ss" );
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.