Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Why is "addDays" not working? (QDate) [SOLVED]
RolBri last edited by RolBri
I would like to get the day of week of yesterday.
Therefore I would like to use
It does not matter wheter I add or substract days.
The int yester is always the day of the week from the current day.
What is wrong?
Tank you :-)
QDate yesterday= QDate::currentDate(); yesterday.addDays(-1); int yester= yesterday.dayOfWeek(); std::cout << "Yesterday was the " << yester << " day of the week." << std::endl;
It's working, you're not using it correctly:
QDate today = QDate::currentDate(); QDate yesterday = today.addDays(-1);
RolBri last edited by
Thank you very much :-)