Results 1 to 5 of 5

Thread: QDateTime without Day

  1. #1
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QDateTime without Day

    Hello everybody,

    OS: WINXP
    Compiler: MINGW
    QT: 3.4

    I am trying to get my current date with time without Day "DO".
    With following function i get this: "Do 16. Feb 10:00:59 2006".
    How could i get just: "16. Feb 10:00:59 2006" ??

    Qt Code:
    1. QDateTime dt = QDateTime::currentDateTime();
    2. QString datum = dt.toString(); //"Do 16. Feb 10:00:59 2006".
    To copy to clipboard, switch view to plain text mode 

    I tried this:
    Qt Code:
    1. QString date = dt.toString(d.M.yy);
    2. QString time = dt.toString(h:m:s);
    3. QString complete = date + " " + time;
    To copy to clipboard, switch view to plain text mode 

    Can somebody help?

    THX
    Think DigitalGasoline

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QDateTime without Day

    Qt Code:
    1. QString date = dt.toString(M.yy);
    To copy to clipboard, switch view to plain text mode 

    doesnt help?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QDateTime without Day

    Hi,
    If i use following code i get a error:
    Qt Code:
    1. QDateTime dt = QDateTime::currentDateTime();
    2. QString datum = dt.toString(M.yy);
    To copy to clipboard, switch view to plain text mode 

    error:
    Qt Code:
    1. ergebnisse.cpp:124: error: `M' undeclared (first use this function)
    2. ergebnisse.cpp:124: error: (Each undeclared identifier is reported only once for
    3. each function it appears in.)
    To copy to clipboard, switch view to plain text mode 
    Think DigitalGasoline

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QDateTime without Day

    sorry

    Qt Code:
    1. QString date = dt.toString("M.yy");
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QDateTime without Day

    of course
    thank you it works perfect..
    Think DigitalGasoline

Similar Threads

  1. Convertng FILETIME timestamp to QDateTime and back again
    By grabnerj in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2008, 22:27
  2. QDateTime GMT add sec. or - sec. from locale time....
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2007, 16:39
  3. Replies: 1
    Last Post: 30th June 2006, 05:24
  4. Invite QDateTime to go 8 secs on future uint
    By patrik08 in forum Newbie
    Replies: 4
    Last Post: 6th June 2006, 23:26
  5. Upper case in QDateTime !!!!
    By paranoid_android in forum Qt Programming
    Replies: 4
    Last Post: 15th March 2006, 08:38

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.