Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Date format to String
Forum Updated to NodeBB v4.3 + New Features

Date format to String

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maniek1310
    wrote on 6 Jun 2014, 16:34 last edited by
    #1

    Hi,

    I have a variable QString date, and now I do not know how to convert that was normal date.

    QString (20140131174428.000000+060) to QString(2014-01-31 17:44:28)

    1 Reply Last reply
    0
    • H Online
      H Online
      hskoglund
      wrote on 6 Jun 2014, 17:06 last edited by
      #2

      QDateTime::fromString("20140131174428.000000+060","yyyyMMddhhmmss.zzz000+060").toString("yyyy-MM-dd HH:mm:ss");

      The microseconds and the timezone GMT+1, couldn't fix easy, maybe they're immaterial?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maniek1310
        wrote on 7 Jun 2014, 07:06 last edited by
        #3

        -I did as you wrote :
        @QDateTime::fromString(system_instalation, "yyyyMMddhhmmss.zzz000+060").toString("yyyy-MM-dd HH:mm:ss");

        ui->system_instalation_2->setText(system_instalation);@
        

        but during the compilation of such errors pops :
        @E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: ostrzeżenie: C4003: not enough actual parameters for macro 'min'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2589: '(' : illegal token on right side of '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2059: syntax error : '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: ostrzeżenie: C4003: not enough actual parameters for macro 'min'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2589: '(' : illegal token on right side of '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2059: syntax error : '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: ostrzeżenie: C4003: not enough actual parameters for macro 'min'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2589: '(' : illegal token on right side of '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2059: syntax error : '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: ostrzeżenie: C4003: not enough actual parameters for macro 'min'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2589: '(' : illegal token on right side of '::'
        E:\Qt_5.3\5.3\msvc2010_opengl\include\QtCore\qdatetime.h:122: błąd: C2059: syntax error : '::'@

        Ps. Already working. It was enough to add to the header file # define NOMINMAX against libraries that belong to the Visual C + + example ("windows.h")

        1 Reply Last reply
        0

        1/3

        6 Jun 2014, 16:34

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved