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


Groups > comp.databases.postgresql > #911

Re: TO_CHAR Issue or Designed feature

From John-Paul Stewart <jpstewart@personalprojects.net>
Newsgroups comp.databases.postgresql
Subject Re: TO_CHAR Issue or Designed feature
Date 2024-01-29 19:06 -0500
Message-ID <l1qssnF228tU1@mid.individual.net> (permalink)
References <3aac0232-1f80-4d25-a6b4-8d4a78012be1n@googlegroups.com>

Show all headers | 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