I´m trying to substract two hours.
QString 1 = "11:00";
QString 2 = "10:00";
I would like to save the result from (11:00 - 10:00) into another QString.
Does anyone know how could I do this?
Thanks for replying!
I would use QTime:
Convert your QStrings to QTime:
QTime a = QTime::fromString("11:00", "HH:mm");
QTime b = QTime::fromString("12:00", "HH:mm");
Get difference in msecs:
int differenceInMsecs = a.msecsTo(b);
(Read QTime:msecsTo() documentation!)
Convert msecs ins whatever you want and put it in QString