Query about time zone patterns in to_char - Mailing list pgsql-hackers

From Nitin Jadhav
Subject Query about time zone patterns in to_char
Date
Msg-id CAMm1aWZ-oZyKd75+8D=VJ0sAoSwtdXWLP-MAWD4D8R1Dgandzw@mail.gmail.com
Whole thread Raw
Responses Re: Query about time zone patterns in to_char
List pgsql-hackers
Hi Hackers,

While understanding the behaviour of the to_char() function as
explained in [1], I observed that some patterns related to time zones
do not display values if we mention in lower case. As shown in the
sample output [2], time zone related patterns TZH, TZM and OF outputs
proper values when specified in upper case but does not work if we
mention in lower case. But other patterns like TZ, HH, etc works fine
with upper case as well as lower case.

I would like to know whether the current behaviour of TZH, TZM and OF
is done intentionally and is as expected.
Please share your thoughts.

[1] - https://www.postgresql.org/docs/current/functions-formatting.html

[2] -
postgres@123613=#select to_char(current_timestamp, 'TZH');
 to_char
---------
 +05
(1 row)

postgres@123613=#select to_char(current_timestamp, 'TZM');
 to_char
---------
 30
(1 row)

postgres@123613=#select to_char(current_timestamp, 'OF');
 to_char
---------
 +05:30
(1 row)

postgres@123613=#select to_char(current_timestamp, 'tzh');
 to_char
---------
 isth
(1 row)

postgres@123613=#select to_char(current_timestamp, 'tzm');
 to_char
---------
 istm
(1 row)

postgres@123613=#select to_char(current_timestamp, 'of');
 to_char
---------
 of
(1 row)

[3] -
postgres@123613=#select to_char(current_timestamp, 'tz');
 to_char
---------
 ist
(1 row)

postgres@123613=#select to_char(current_timestamp, 'TZ');
 to_char
---------
 IST
(1 row)

postgres@123613=#select to_char(current_timestamp, 'HH');
 to_char
---------
 08
(1 row)

postgres@123613=#select to_char(current_timestamp, 'hh');
 to_char
---------
 08
(1 row)

Thanks & Regards,
Nitin Jadhav



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: Asynchronous Append on postgres_fdw nodes.
Next
From: Tom Lane
Date:
Subject: Re: Query about time zone patterns in to_char