Results 1 to 9 of 9

Thread: issue with sqlite select qry by date & time for 24 hour period

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2016
    Posts
    99
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default issue with sqlite select qry by date & time for 24 hour period

    When I out put begin and end dates there not what I expect I just want the begin date variable to get current date with time set to zero (beginning of day)
    I want the end date variable to get the current date with the time set to midnight basically (end of day)

    but its not quit working

    Qt Code:
    1. QDateTime beginDate = QDateTime::currentDateTime();
    2. beginDate.setTime(QTime(0,0,0,0));
    3. QDateTime endDate = QDateTime::currentDateTime();
    4. endDate.setTime(QTime(23,59,59,999));
    5.  
    6. qDebug() << "beginDate: " << beginDate; //not what I'm expecting to get
    7. qDebug() << "endDate: " << endDate;
    8.  
    9. QSqlQuery selectQuery("SELECT * FROM userlogevents WHERE dateTime BETWEEN ? and ?", m_selectDataBase);
    10. selectQuery.addBindValue(beginDate);
    11. selectQuery.addBindValue(endDate);
    To copy to clipboard, switch view to plain text mode 
    Last edited by anda_skoa; 6th October 2016 at 16:12.

Similar Threads

  1. select estimate comboBox,date et time
    By aymenkn in forum Qt Programming
    Replies: 4
    Last Post: 28th March 2014, 07:56
  2. Replies: 5
    Last Post: 19th April 2011, 11:13
  3. Replies: 2
    Last Post: 13th April 2010, 16:50
  4. Replies: 1
    Last Post: 15th April 2009, 09:00
  5. drawing points on canvas after a time period
    By quickNitin in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2006, 14:12

Tags for this Thread

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.