Difference between two dates.
-
wrote on 27 Oct 2018, 22:28 last edited by
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)
-
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()
-
wrote on 27 Oct 2018, 22:57 last edited by
Have a look herre :-
https://forum.qt.io/topic/27906/difference-in-days-months-and-years-between-two-datesRegards
-
Have a look herre :-
https://forum.qt.io/topic/27906/difference-in-days-months-and-years-between-two-datesRegards
wrote on 28 Oct 2018, 21:55 last edited by@mad-hatter Thanks
1/4