Results 1 to 3 of 3

Thread: Date format is not display

  1. #1
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Date format is not display

    Hi,

    I am inserting the date in database in the string format dd/MM/yyyy

    but when I display the date in table the format is change and it display yyyy/MM/dd

    Qt Code:
    1. QString cdate = date.currentDate().toString("dd/MM/yyyy");
    To copy to clipboard, switch view to plain text mode 


    Its a simple question Can anyone tell me that Why it occur?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Date format is not display

    I guess the date is not inserted as string but as date type.
    When you select from your table the date then is displayed in the default format of a date.

    Solution:
    * insert the date "as a date"
    * either use some special function in your select call (in Oracle you can tell the db to format a date (as a string) in some format)
    * or "tell" your view (whatever you are using) to format dates the way you want to see them.

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

    sosanjay (9th November 2009)

  4. #3
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Date format is not display

    In my database field is by default date.
    I think your logic works.Thanks

Similar Threads

  1. QDateEdit Resize for Changed Display Format?
    By ChrisW67 in forum Newbie
    Replies: 5
    Last Post: 5th June 2009, 10:02
  2. Replies: 1
    Last Post: 15th April 2009, 09:00
  3. Date and Time format.
    By kaushal_gaurav in forum Qt Programming
    Replies: 3
    Last Post: 12th August 2008, 11:36
  4. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48
  5. Replies: 7
    Last Post: 17th November 2007, 11:33

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.