Re: Time zone offset in to_char() - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Time zone offset in to_char()
Date
Msg-id 2804e2d7-3c27-4097-97d9-d05377dbb31b@aklaver.com
Whole thread Raw
In response to Re: Time zone offset in to_char()  (Alban Hertroijs <a.hertroijs@nieuwestroom.nl>)
List pgsql-general
On 1/12/24 00:51, Alban Hertroijs wrote:

> Following up on my own mail from yesterday evening, here's the output 
> that shows the function using set_config 'leaking' the timezone change 
> to outside the function (the first select vs. the 2^nd  select) into the 
> (same) transaction, whereas the function with the time zone bound to the 
> header does not (the 3^rd  select).
> These are all from a single session, ran consecutively - a straight 
> copy-paste from psql.


Alright I see what you are talking about.

> 
> ciscache=> select ToDatetimeOffset(current_timestamp, 
> 'Europe/Amsterdam'), to_char(current_timestamp, 'YYYY-MM-DD 
> HH24:MI:SS.US0 TZH:TZM');
>            todatetimeoffset          |              to_char
> ------------------------------------+------------------------------------
>   2024-01-12 09:41:44.7019350 +01:00 | 2024-01-12 09:41:44.7019350 +01:00
> (1 row)
> 
> ciscache=> select to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US0 
> TZH:TZM');
>                to_char
> ------------------------------------
>   2024-01-12 08:41:54.4739800 +00:00
> (1 row)
> 
> ciscache=> select ToDatetimeOffsetNL(current_timestamp), 
> to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US0 TZH:TZM');
>           todatetimeoffsetnl         |              to_char
> ------------------------------------+------------------------------------
>   2024-01-12 09:42:44.1989210 +01:00 | 2024-01-12 08:42:44.1989210 +00:00
> (1 row)
> 
> Regards,
> Alban Hertroijs.
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: David Hussey
Date:
Subject: Support for arm64 windows is absent - Would be nice to have!
Next
From: Adrian Klaver
Date:
Subject: Re: Issue with loading unicode characters with copy command