[SOLVED] QDate QDate::addDays ( int ndays ) works....?
-
Hi Everyone, I want to add 15 days to the current date. For that I wrote the code like this,
@ QDate IssueDate, ReturnDate;
QString IsDt= IssueDate.currentDate().toString(Qt::ISODate);
ReturnDate = IssueDate.addDays(15);
QString RtDt= ReturnDate.toString(Qt::ISODate);@But it is giving NULL. Can anyone tell me where is the problem...?
Thank You.
-
because your dates are not initialized. Using static function on uninitialized object does not updates this object...
@
QDate issueDate = QDate::currentDate();
QDate ReturnDate;
QString IsDt= IssueDate.toString(Qt::ISODate);ReturnDate = IssueDate.addDays(15);
QString RtDt= ReturnDate.toString(Qt::ISODate);
@If it solves your problem, please add "[SOLVED]" prefix left to the topic subject. Thanks!
-
Thank you AcerExtensa. I got it.