Re: Year 2024: Extracting week from date gives wrong results for thelast two days of the year

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Year 2024: Extracting week from date gives wrong results for thelast two days of the year
Дата
Msg-id CAMkU=1z3kvz_Nv9TmZ1Xii8svhvPA4=BkZAujS5+G-Ta6jjKAw@mail.gmail.com
обсуждение исходный текст
Ответ на Year 2024: Extracting week from date gives wrong results for the lasttwo days of the year  (Michael Monscheuer <mm@digiperience.de>)
Список pgsql-bugs


On Wed, Jul 4, 2018 at 9:55 AM, Michael Monscheuer <mm@digiperience.de> wrote:
Team,

Extracting the week from a date gives wrong results for the last two days of 2024.

SELECT EXTRACT (WEEK FROM DATE '20241230');

or

SELECT EXTRACT (WEEK FROM DATE '20241231');

both result in a value of  1
which is wrong, obviously...


Not wrong.  See the docs:

By definition, ISO weeks start on Mondays and the first week of a year contains January 4 of that year.
 
So the first week of 2025 contains some days from 2024.

Cheers,

Jeff

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

Предыдущее
От: Michael Monscheuer
Дата:
Сообщение: Year 2024: Extracting week from date gives wrong results for the lasttwo days of the year
Следующее
От: Félix GERZAGUET
Дата:
Сообщение: Re: Year 2024: Extracting week from date gives wrong results for thelast two days of the year