开发者

Date check for counting 30 days

I want to count the days passed with respect to a given date. I have a predefined date with me and i want to check the days passed, once the day pass 30 days with respect to the given time i want to get a message.

example given date is25/03/2010 and when my system date reaches 25/04/2010 开发者_StackOverflowi have to get a message. How can i implement it. please give some help


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜