Use daysTo function:
QDate _SomeDate
(2008,
8,
12);
qint32 _Difference = _Today.daysTo(_SomeDate)
switch(_Difference)
{
case -1:
_Day="Yesterday";
break;
case 0:
_Day="Today";
break;
case 1:
_Day="Tomorrow";
break;
default:
_Day=_SomeDate.toString("dd mmm");
break
}
QDate _Today=QDate::currentDate();
QDate _SomeDate(2008,8,12);
QString _Day;
qint32 _Difference = _Today.daysTo(_SomeDate)
switch(_Difference)
{
case -1:
_Day="Yesterday";
break;
case 0:
_Day="Today";
break;
case 1:
_Day="Tomorrow";
break;
default:
_Day=_SomeDate.toString("dd mmm");
break
}
To copy to clipboard, switch view to plain text mode
Bookmarks