On 5/15/20 9:38 AM, PegoraroF10 wrote:
Ok Tom but then you cannot go back and forth, like this ...
select to_timestamp(jsonb_build_object('mydate',
current_timestamp)->>'mydate', 'YYYY-MM-DD HH24:MI:SS');
select jsonb_build_object('mydate',
current_timestamp);
jsonb_build_object
------------------------------------------------
{"mydate": "2020-05-15T10:54:17.913596-07:00"}
(1 row)
Option 1:
select to_timestamp(jsonb_build_object('mydate',
current_timestamp)->>'mydate', 'YYYY-MM-DD T HH24:MI:SS');
to_timestamp
-------------------------
05/15/2020 10:54:20 PDT
Option 2 per Tom's suggestion:
select (jsonb_build_object('mydate',
current_timestamp)->>'mydate')::timestamptz;
timestamptz
--------------------------------
05/15/2020 10:54:58.649859 PDT
works on 11.7 but not on 12.3.
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
--
Adrian Klaver
adrian.kla...@aklaver.com