Results 1 to 2 of 2

Thread: Extract the year only from a qdate

  1. #1
    Join Date
    Apr 2017
    Posts
    55
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Extract the year only from a qdate

    How do I get the year only out of a qdate query? A code snippet would be very helpful.

    the reference to http://doc.qt.io/qt-5/qdatetime.html#toTime_t wasn't particularly helpful.

    Thanks for any help

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Extract the year only from a qdate

    One would think that QDateTime::date() followed by QDate::year() could be easily found by reading further into the documentation at the link you posted.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Get the date from day of year and year details
    By gfernandes in forum Newbie
    Replies: 4
    Last Post: 17th May 2014, 00:41
  2. Happy New Year!!!
    By fengtian.we in forum General Discussion
    Replies: 6
    Last Post: 4th January 2012, 07:07
  3. QDate and two digit year
    By Lesiok in forum Qt Programming
    Replies: 8
    Last Post: 24th March 2011, 10:13
  4. QDate SystemLocaleShortDate without year
    By martinn in forum Qt Programming
    Replies: 3
    Last Post: 24th February 2010, 19:17
  5. hello. happy new year
    By Andrewliu in forum General Discussion
    Replies: 4
    Last Post: 30th December 2006, 20:35

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.