Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] QTime::fromString() not working
xalam last edited by
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
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?
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" );