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 yyyy-MM-ddThh: mm: ssTZD from QDateTime
Forum Updated to NodeBB v4.3 + New Features

How to get yyyy-MM-ddThh: mm: ssTZD from QDateTime

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

    I'm trying to get the time zone date using QDateTime, what I expect is something like 2018-03-19T00: 00: 00-02: 00 but what I get is 2019-10-27T19: 56: 09-2147483648

    QDateTime dh = QDateTime::currentDateTimeUtc();
        QString dataHoraEmi = dh.toString("yyyy-MM-ddThh:mm:ss");
        dataHoraEmi.append(dh.timeZone().offsetData(dh).standardTimeOffset);
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you looking to the date in the ISO-8601 format ? If so, I think this overload of toString will be of interest.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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