Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • 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);
    

  • Lifetime Qt Champion

    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


Log in to reply