Unsolved Difference between two dates.
-
Hello guys
I'm doing a job and I have a question.
I got 2 dates from a QDate, and I need to subtract the 2 dates and pick up the days.
It is a hotel program, the user must enter the day of entry and the day of departure and need to know how many days he stayed to multiply by the price.
How can I make a difference between these two dates?
QDate IniDate =ui->dateIni->date(); QDate endDate =ui->dateEnd->date(); QString dateIni = IniDate.toString(); QString dateEnd = endDate.toString();
I need (dateEnd - dateIni)
-
@Caio.Sousa said in Difference between two dates.:
How can I make a difference between these two dates?
QDateTime::secsTo() / QDateTime::daysTo()
-
Have a look herre :-
https://forum.qt.io/topic/27906/difference-in-days-months-and-years-between-two-datesRegards
-
@mad-hatter Thanks