Re: BUG #16238: Function " to_char(timestamp, text) " doesn't workproperly

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: BUG #16238: Function " to_char(timestamp, text) " doesn't workproperly
Дата
Msg-id 20200130124823.GA7512@depesz.com
обсуждение исходный текст
Ответ на BUG #16238: Function " to_char(timestamp, text) " doesn't work properly  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
On Thu, Jan 30, 2020 at 11:49:45AM +0000, PG Bug reporting form wrote:
> For example this query "
> select to_char('2020-01-29'::date,'Day') " give me this result "Wednesday",
> but this query " select to_char('2020-01-31'::date,'Day') "  give me this
> result "Friday   ".
> So, i guess it is not right to have days with many spaces as a result and
> some days without any space.

First of all - it's not a bug - function works exactly as documented:
https://www.postgresql.org/docs/current/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIME-TABLE
says:

"Day" -> full capitalized day name (blank-padded to 9 chars).

If you don't want the padding, use FM modifier, like:

select to_char('2020-01-31'::date,'FMDay');

Best regards,

depesz




В списке pgsql-bugs по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Bug in display of commit logs on git.postgresql.org
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Bug in display of commit logs on git.postgresql.org