PDA

View Full Version : QDate minus one week



^NyAw^
29th May 2008, 15:38
Hi,

How can I obtain the Date minus one week? p.e.: the date is(yyyy-mm-dd) "2008-05-03" and I want to get "2008-04-26".

QDate class let's me add days, months and years, but don't let me do substraction.

Thanks,

Lesiok
29th May 2008, 15:46
From QDate::addDays doc :
Returns a QDate object containing a date ndays later than the date of this object (or earlier if ndays is negative).

So just do QDate::addDays(-7)

^NyAw^
29th May 2008, 15:46
Hi,

Yes yes, just writing code before reading doc.:rolleyes:

Thanks,