You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use wal2json and psycopg2 to got postgresql data change. I have a question on the format of datatime. In psql I have column type timestamp with timezone
In psql console:
postgres=# select create_time from test limit 1;
create_time
-------------------------------
2018-05-18 03:06:22.446039+00
In some graph ide like DataGrip (after I click on the column)
create_time
2018-05-18 03:06:22.446039 +00:00
The wal2json return '2018-05-18 03:06:22.446039+00'. But I look at https://docs.python.org/3/library/datetime.html The %z is '+0000' have 4 digit.
Does I got some misunderstanding on the stand?
The text was updated successfully, but these errors were encountered:
@jiamo wal2json uses the same output as the corresponding data type. Take a look at backend/utils/adt/datetime.c, function EncodeTimezone. If the timezone have its minute part as zero, it is not printed (which means that -03:00 will be printed as -03 and -03:30 will be printed as -03:30 ). AFAIR ISO 8601 supports minutes omission in timezone specification (-07:00 is the same as -07 ).
The output depends on DateStyle parameter (read [1]).
postgres=# show DateStyle;
DateStyle
-----------
ISO, MDY
(1 row)
postgres=# select now();
now
-------------------------------
2018-05-23 02:56:06.535951+00
(1 row)
postgres=# set DateStyle to 'SQL';
SET
postgres=# select now();
now
--------------------------------
05/23/2018 02:56:27.382021 UTC
(1 row)
postgres=# set DateStyle to 'Postgres';
SET
postgres=# select now();
now
-------------------------------------
Wed May 23 02:56:37.656014 2018 UTC
(1 row)
I use wal2json and psycopg2 to got postgresql data change. I have a question on the format of datatime. In psql I have column type
timestamp with timezone
In psql console:
In some graph ide like DataGrip (after I click on the column)
The wal2json return '2018-05-18 03:06:22.446039+00'. But I look at https://docs.python.org/3/library/datetime.html The
%z
is '+0000' have 4 digit.Does I got some misunderstanding on the stand?
The text was updated successfully, but these errors were encountered: