Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #911

Re: TO_CHAR Issue or Designed feature

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From John-Paul Stewart <jpstewart@personalprojects.net>
Newsgroups comp.databases.postgresql
Subject Re: TO_CHAR Issue or Designed feature
Date Mon, 29 Jan 2024 19:06:47 -0500
Lines 24
Message-ID <l1qssnF228tU1@mid.individual.net> (permalink)
References <3aac0232-1f80-4d25-a6b4-8d4a78012be1n@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace individual.net SwL7b+kL+Y4JnlZ/EcvbfQ3EZF3ZFHCsOjPCsgaoc8QnHkt0Fu
Cancel-Lock sha1:zvRMaQSGUiUMn2UDdfIpi0SasiA= sha256:CBdxK311gBQglDqUizYeQspa+8v4/IV0Pyc5AUj2/yc=
User-Agent Mozilla Thunderbird
Content-Language en-CA
In-Reply-To <3aac0232-1f80-4d25-a6b4-8d4a78012be1n@googlegroups.com>
Xref csiph.com comp.databases.postgresql:911

Show key headers only | View raw


On 2024-01-29 17:22, Thomas Morgan wrote:
> When I issue following
> 
>    SELECT to_char(now(), 'Hh24')  Current_Hour;
> 
> I get:
> 
>      current_hour 
>      --------------
>      Hh24
>      (1 row)
> 
> Is this documented or it it a flaw.  Should it be doing the format
> case insensitive?

Although it is not explicitly stated, the format string must be case
sensitive.  You can infer that from the following table:

https://www.postgresql.org/docs/15/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIME-TABLE

Note the difference between "AM" and "am", or "MONTH" and "Month" and
"month".  (To name just two examples.)  Based on that, it should be
obvious that the pattern has to be interpreted in a case sensitive manner.

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Find similar


Thread

TO_CHAR Issue or Designed feature Thomas Morgan <thomasmorgan09061966@gmail.com> - 2024-01-29 14:22 -0800
  Re: TO_CHAR Issue or Designed feature John-Paul Stewart <jpstewart@personalprojects.net> - 2024-01-29 19:06 -0500

csiph-web