Results 1 to 5 of 5

Thread: Regarding QDate?

  1. #1
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Regarding QDate?

    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....

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Regarding QDate?

    QDate::addDays(-1)

    Read the doc

  3. The following user says thank you to aamer4yu for this useful post:

    qtlinuxnewbie (5th February 2010)

  4. #3
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Regarding QDate?

    Thank you aamer

  5. #4
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Regarding QDate?

    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?

  6. #5
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Regarding QDate?

    my problem solved.
    u need to change that as QDate yes =QDate::Current Date().addDays(-1);

Similar Threads

  1. Getting QDate from string
    By yagabey in forum Qt Programming
    Replies: 10
    Last Post: 17th February 2009, 15:40
  2. Problems with QDate
    By cyberboy in forum Qt Programming
    Replies: 4
    Last Post: 25th May 2008, 21:17
  3. QTableView & QDate
    By Shaitan in forum Qt Programming
    Replies: 3
    Last Post: 18th July 2007, 10:06
  4. QDate Help pls
    By munna in forum Qt Programming
    Replies: 6
    Last Post: 8th May 2006, 06:50
  5. Two QDate issues
    By GreyGeek in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2006, 02:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.