Check date for 30 days

I want to calculate the days elapsed for a specific date. I have a predefined date with me, and I want to check the past days, as soon as the day has passed 30 days in relation to this time, I want to receive a message.

An example of a given date is is25 / 03/2010, and when my system date reaches 04/25/2010, I should get a message. How can I implement it. please, help

+3
source share
2 answers

QDateTime::daysTo(const QDateTime &other) must do the work

+2
source

Not tested, but this is the logic:

QDate original = QDate(your_year, your_month, your_date);
original.addDays(30);

if (original > QDate::currentDate())
{
    displayMessage();
}

http://doc.qt.io/qt-4.8/qdate.html

+5
source

Source: https://habr.com/ru/post/1738475/


All Articles