QDate difference in days code example
Example: qdate difference between two dates
#include <QApplication>
#include <QDate>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// get current date
QDate dNow(QDate::currentDate());
// create other date
// by giving date 12.21.2012 (joke about end of the world)
QDate dEndOfTheWorld(2012, 12, 21);
qDebug() << "Today is" << dNow.toString("dd.MM.yyyy")
<< "Days to end of the world: "
<< dNow.daysTo(dEndOfTheWorld);
return a.exec();
}