Results 1 to 2 of 2

Thread: how to calculate difference b/w two times

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to calculate difference b/w two times

    Hi to all,


    I am developing an application where i need to login time and save it in database, when ever admin wants to see when ever i need to display all login users and login time in a table widget.

    when ever the user logout i need to save the current time and calculate how many hours he logged in.

    Can any one tell how to find difference b/w two times( one is in database and one is current time).

    i am waiting for your replies and valuable suggestions.


    Regards,

    Narasimha Raju. Naidu

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to calculate difference b/w two times

    QDateTime has QDateTime::daysTo() and QDateTime::secsTo() methods that you can use. Then you can use QTime::addSecs() to easily convert it to hours, minutes and seconds.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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
  •  
Qt is a trademark of The Qt Company.