Results 1 to 2 of 2

Thread: Problem with QDateTime

  1. #1
    Join Date
    May 2012
    Posts
    99
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QDateTime

    I've detected the problem, the datetime "2013-09-09T02:23:60Z" is invalid. The correct datetime is "2013-09-09T02:24:00Z".

    Regards.
    Last edited by qt_developer; 18th September 2014 at 07:38.

  2. #2
    Join Date
    May 2012
    Posts
    99
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QDateTime

    Hi all,

    I have this code:

    Qt Code:
    1. Qt::DateFormat format = Qt::ISODate;
    2. QDateTime dateTime = QDateTime::fromString("2013-09-09T02:23:60Z", format);
    3. QString year = QString::number(dateTime.date().year());
    4. QString month = QString::number(dateTime.date().month());
    5. QString day = QString::number(dateTime.date().day());
    6. qDebug() << "dateTime:" << dateTime.toString(format) << "year:" << year << "month:" << month << "day:" << day;
    To copy to clipboard, switch view to plain text mode 

    and I get this output: datetime: "" year: "0" month: "0" day: "0"

    What's wrong?

    Best regards.

    I've detected the problem. The datetime "2013-09-09T02:23:60Z" is invalid. The correct datetime is "2013-09-09T02:24:00Z".

    Regards.

Similar Threads

  1. QDateTime UTC Time_t problem
    By scieck in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2012, 06:47
  2. QDateTime .setTime problem
    By sergiofil in forum Newbie
    Replies: 1
    Last Post: 28th April 2011, 16:40
  3. QDateTime problem
    By Majdi in forum Newbie
    Replies: 11
    Last Post: 28th January 2009, 15:57
  4. Problem with comparing two QDateTime objects
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2008, 11:27
  5. QDateTime without Day
    By raphaelf in forum Qt Programming
    Replies: 4
    Last Post: 16th February 2006, 11: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.