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. Qdatetime conversion fails
Forum Updated to NodeBB v4.3 + New Features

Qdatetime conversion fails

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 206 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.
  • Jonathan LevanonJ Offline
    Jonathan LevanonJ Offline
    Jonathan Levanon
    wrote on last edited by
    #1

    I'm trying to parse this string
    2020-07-28 16:37:35
    to QDatetime using
    QDateTime::fromString(str, "YYYY-MM-dd HH:mm:ss");

    But get invalid output. Tried all kinds of formats, but it fails. Any help?

    jsulmJ 1 Reply Last reply
    0
    • Jonathan LevanonJ Jonathan Levanon

      I'm trying to parse this string
      2020-07-28 16:37:35
      to QDatetime using
      QDateTime::fromString(str, "YYYY-MM-dd HH:mm:ss");

      But get invalid output. Tried all kinds of formats, but it fails. Any help?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Jonathan-Levanon said in Qdatetime conversion fails:

      QDateTime::fromString(str, "YYYY-MM-dd HH:mm:ss");

      QDateTime::fromString(str, "yyyy-MM-dd HH:mm:ss");
      

      maybe?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • Jonathan LevanonJ Offline
        Jonathan LevanonJ Offline
        Jonathan Levanon
        wrote on last edited by
        #3

        Exactly, thanks!

        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