PDA

View Full Version : Substract two QStrings



Alberto7
26th October 2015, 14:31
Hi,
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!

Lesiok
26th October 2015, 14:48
QString str_1 = "11:00";
QString str_2 = "10:00";
QString result = str_1 + " - " + str_2;

anda_skoa
26th October 2015, 15:59
In case you want to calculate the time difference, see QTime::fromString().

Cheers,
_