Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86450

PGSQL: query does not returns a QDateTime with timezone

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Out of scope
    • Affects Version/s: 5.11.3, 5.14.2
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      Given a postgresql table with a column with type timestamptz:

      create table patients
       (
       patient_id serial not null,
       date_time_added timestamptz not null
       );

      The table has one row with date_time_added with value 2020-08-03 12:45:34.335-03

      I query the table with:

      QSqlQuery query;

       

      if(query.exec("SELECT patient_id, date_time_added FROM patients"))
      {
         query.next();
         auto dTA = query.value(1).toDateTime();
         qDebug() << dTA.toString(Qt::IsoDateWithMs);
      }

       

      I would expect to see the timezone in the string, but I get the string without it. I need to manually set the time zone in order to get the right value.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            mabrand Mark Brand
            Reporter:
            lisandropm Lisandro Damián Nicanor Pérez Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes