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]QDateTime::fromString() doesn't work
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QDateTime::fromString() doesn't work

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.3k 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.
  • T Offline
    T Offline
    Tecnova
    wrote on last edited by
    #1

    Hello,
    I need to read a DateTime from a String so I tried the fromString() function.
    I did a little test function, because in my real Program it doesn't work correctly.
    @ QString timeString("13.12.2013 12:45:30.555");
    QDateTime time;
    time.fromString(timeString, "dd.MM.yyyy-hh:mm:ss.zzz");@

    when I do it like that the time is always invalid

    What do I do wrong? I really don't understand what could be wrong.

    thanks for your help

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tecnova
      wrote on last edited by
      #2

      @ QString timeString("13.12.2013 12:45:30.555");
      QDateTime time;
      time = time.fromString(timeString, "dd.MM.yyyy-hh:mm:ss.zzz");@
      is correct

      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