Results 1 to 4 of 4

Thread: Date Time

  1. #1
    Join Date
    Mar 2008
    Posts
    29
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Date Time

    Hi,
    I have to calculate how many day are between two date events, for example:
    How many dates are from Jan/2008 to Jul/2009.
    Is there any help from Qt ?
    Do you know how I have to implement ?

    Thanks
    Alex

  2. #2
    Join Date
    Mar 2008
    Posts
    29
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Date Time

    ups, sorry, ok, there is a function called "daysTo()" from QDate, I think it will help me...

  3. #3
    Join Date
    Jan 2006
    Location
    England
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Date Time

    How about:

    QDate date1 = QDate::fromString( "Jan 2008", "MMM yyyy");
    QDate date2 = QDate::fromString( "Jul 2009", "MMM yyyy");

    int numberOfDays = date1.daysTo( date2 );

    The above gives the number of days between those two dates.

    HTH
    McToo
    It's always a long day, you can't fit 86400 into a short!

  4. #4
    Join Date
    Jan 2006
    Location
    England
    Posts
    18
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Date Time

    Beat me to it!
    It's always a long day, you can't fit 86400 into a short!

Similar Threads

  1. time and date issues
    By boog07005 in forum Newbie
    Replies: 5
    Last Post: 20th August 2012, 15:15
  2. automatic time and date updating
    By sudheer in forum Qt Tools
    Replies: 1
    Last Post: 17th January 2008, 10:00
  3. How to set the file's date and time.
    By santosh.kumar in forum General Programming
    Replies: 3
    Last Post: 12th October 2007, 11:13
  4. to set date and time in the file info of two days back
    By thomasjoy in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2007, 16:54
  5. chage date and time
    By behnia_k in forum General Programming
    Replies: 4
    Last Post: 18th July 2007, 12:48

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.