Results 1 to 3 of 3

Thread: Difficulties with QDateTime.

  1. #1

    Default Difficulties with QDateTime.

    Hi!

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

    So, I just set up the date like this :

    Qt Code:
    1. QStringList sList = date.split("/");
    2. QDate date = QDate::fromString(sList.at(0)+"MM"+sList.at(1)+"yyyy"+sList.at(2), "d'MM'yyyy");
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. if (date.toString("d'MM'yyyy") == finfo.lastModified().toString("d'MM'yyyy")) {
    2. //Some code.
    3. }
    To copy to clipboard, switch view to plain text mode 

    It doesn't enter into the if,

  2. #2
    Join Date
    Feb 2012
    Location
    Warsaw, Poland
    Posts
    37
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Difficulties with QDateTime.

    Show actual code

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Difficulties with QDateTime.

    Also, if you want to compare dates, why don't you compare the dates?

    Cheers,
    _

Similar Threads

  1. Difficulties in Making PDF files in Mac PCs
    By ceraolo in forum Qt Programming
    Replies: 9
    Last Post: 17th April 2014, 17:45
  2. Difficulties compiling qt statically
    By tom989 in forum Installation and Deployment
    Replies: 1
    Last Post: 17th November 2012, 01:38
  3. Difficulties with QTableView and setModel
    By sekatsim in forum Qt Programming
    Replies: 11
    Last Post: 19th June 2008, 08:05
  4. QTableView header difficulties
    By croftj in forum Qt Programming
    Replies: 6
    Last Post: 30th January 2008, 21:58
  5. QDateTime without Day
    By raphaelf in forum Qt Programming
    Replies: 4
    Last Post: 16th February 2006, 12:42

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.