Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I didn't find how to count the number of days between two Date. I also need to be able to add a number of days to a Date and print the resulting Date.
mranger90 last edited by
You mean like QDate::daysTo() and QDate::addDays() ?
Suggest you look at:
Yes I need functions like this but in QML
Ok it seems there is no official method to do it so I use :
function dateDiffInDays(date1, date2)
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
return Math.ceil(timeDiff / (1000 * 3600 * 24));