Re: BUG #16192: Function to_char(date,'IW') return incorrect valuefor last days of a year

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: BUG #16192: Function to_char(date,'IW') return incorrect valuefor last days of a year
Дата
Msg-id f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net
обсуждение исходный текст
Ответ на BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form schrieb am 06.01.2020 um 09:39:
> According to ISO 8691 specifications, the first week of a year is the week
> containing the first thursday of the year. Thus, the 30 and 31 of december
> 2019 should be in the first week of 2020, but "to_char" set them in the
> first week of... 2019!
>
> [postgres] $ psql
> psql (9.6.6)
> Saisissez « help » pour l'aide.
>
> # select to_char('2019-12-30'::date, 'YYYY-IW');
>   to_char
> ---------
>   2019-01
> (1 ligne)

Not a bug.

To get the year corresponding to the ISO week, you need to use the format for the "ISO Year"

select to_char('2019-12-30'::date, 'IYYY-IW');



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year
Следующее
От: "f的梦"
Дата:
Сообщение: Report bug!