PDA

View Full Version : Difficulties with QDateTime.



LaurentDuroisin
19th January 2016, 09:21
Hi!

I enter a date in this format : d/MM/yyyy

So, I just set up the date like this :



QStringList sList = date.split("/");
QDate date = QDate::fromString(sList.at(0)+"MM"+sList.at(1)+"yyyy"+sList.at(2), "d'MM'yyyy");


But there is a problem when I want to compare dates :


if (date.toString("d'MM'yyyy") == finfo.lastModified().toString("d'MM'yyyy")) {
//Some code.
}


It doesn't enter into the if,

west
19th January 2016, 11:25
Show actual code

anda_skoa
19th January 2016, 16:04
Also, if you want to compare dates, why don't you compare the dates?

Cheers,
_