PDA

View Full Version : Regarding QDate?



qtlinuxnewbie
5th February 2010, 06:13
Hi,

i want to know how to subtract from the current date.
i have a menu in my form which contains the options , Today, Yesterday, last week.
Under the Today option i am able to get the work done with the QDate::current date() and getting the date .
My question is how can i get the Yesterday date??
i mean how can i subtract 1 from my current date.

Thanks in advance....

aamer4yu
5th February 2010, 06:20
QDate::addDays (-1)

Read the doc

qtlinuxnewbie
5th February 2010, 06:24
Thank you aamer

qtlinuxnewbie
5th February 2010, 06:35
QDate yes =QDate::addDays(-1);
i am getting the following error:
error: cannot call member function ‘QDate QDate::addDays(int) const’ without object

wht changes, do i need to do?

qtlinuxnewbie
5th February 2010, 07:02
my problem solved.
u need to change that as QDate yes =QDate::Current Date().addDays(-1);