Results 1 to 3 of 3

Thread: How to get year or month from QDateEdit ?

  1. #1
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to get year or month from QDateEdit ?

    I have and DateEdit with format 'MM/yyyy', see pic:

    1.png

    How to get year and month values.

    year: 2006
    month: 6

    thanks for help !

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get year or month from QDateEdit ?

    Qt Code:
    1. QDateEdit m_date_edit;
    2. int year = m_date_edit.date().year();
    3. int month = m_date_edit.date().month();
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to Lesiok for this useful post:

    hohoanganh205 (4th January 2012)

  4. #3
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to get year or month from QDateEdit ?

    thanks Lesiok, that code work .

Similar Threads

  1. Happy New Year!!!
    By fengtian.we in forum General Discussion
    Replies: 6
    Last Post: 4th January 2012, 06:07
  2. Replies: 0
    Last Post: 1st August 2011, 09:32
  3. QDateEdit Month/Day Rollover
    By giverson in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2008, 18:57
  4. Replies: 0
    Last Post: 2nd May 2007, 10:53
  5. hello. happy new year
    By Andrewliu in forum General Discussion
    Replies: 4
    Last Post: 30th December 2006, 19:35

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.