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. [SOLVED] storing system date in a variable
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] storing system date in a variable

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.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.
  • O Offline
    O Offline
    ommz
    wrote on last edited by
    #1

    I need to store the current system date in ddMMyyyy format (without periods nor slashes in between) in a variable. Someone sgow me a simple snippet please.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Try this:
      @
      QString str = QDate::currentDate().toString ( "ddMMyyyy" );
      @

      Note: not tested, brain to keyboard.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • ZlatomirZ Offline
        ZlatomirZ Offline
        Zlatomir
        wrote on last edited by
        #3

        Look at QDate's "toString":http://doc.qt.nokia.com/4.7-snapshot/qdate.html#toString member function

        https://forum.qt.io/category/41/romanian

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          "QDate::currentDate()":http://qt-project.org/doc/qt-4.8/qdate.html#currentDate
          "QDate::toString()":http://qt-project.org/doc/qt-4.8/qdate.html#toString

          @
          QString systemDate = QDate::currentDate().toString("ddMMyyyy");
          @

          1 Reply Last reply
          0

          • Login

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