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]convert mysql time to QDateTime and vise versa
Forum Updated to NodeBB v4.3 + New Features

[Solved]convert mysql time to QDateTime and vise versa

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 12.1k 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.
  • N Offline
    N Offline
    Naouali
    wrote on last edited by
    #1

    Hi ALL
    how can i convert Mysql time to QDateTime ?
    thanks in advance .

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      The Qt Sql drivers do that for you already. You can just use QVariant::toDateTime on your query result.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Naouali
        wrote on last edited by
        #3

        thanks that works.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          Naouali
          wrote on last edited by
          #4

          Hi
          how can i convert a QDateTime to Mysql datetime ?

          thanks in advance

          1 Reply Last reply
          0
          • L Offline
            L Offline
            luca
            wrote on last edited by
            #5

            .toString("yyyy-MM-dd hh:mm:ss");

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              [quote author="Naouali" date="1306334812"]Hi
              how can i convert a QDateTime to Mysql datetime ?

              thanks in advance[/quote]

              Same way as you do it the other way around: simply rely on the Qt Sql drivers framework to do that for you.

              I merged this question with the one you asked about doing it the other way around.

              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