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. How to get the date from QDateEdit in XXXX-XX-XX format?
QtWS25 Last Chance

How to get the date from QDateEdit in XXXX-XX-XX format?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.8k Views
  • 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.
  • B Offline
    B Offline
    Batyu
    wrote on last edited by
    #1
    QDate date = ui->dateEdit->date();
    std::string strDate = date.toString().toStdString();
    

    How can I store the date in XXXX-XX-XX format as string?

    Pl45m4P 1 Reply Last reply
    0
    • B Batyu
      QDate date = ui->dateEdit->date();
      std::string strDate = date.toString().toStdString();
      

      How can I store the date in XXXX-XX-XX format as string?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Batyu

      strDate = date.toString("yyyy-MM-dd").toStdString();
      

      Other options and different formats are shown here:
      https://doc.qt.io/qt-5/qdate.html#toString-4


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      3

      • Login

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