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

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Michael Monscheuer <mm(at)digiperience(dot)de>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Year 2024: Extracting week from date gives wrong results for the last two days of the year
Date: 2018-07-04 17:21:02
Message-ID: ad47a15e-8c55-7561-3de6-7143963b3205@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 05/07/18 01:55, Michael Monscheuer 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...
>
> The expected result is 53
>
> The results for the year 2020 are correct:
> SELECT EXTRACT (WEEK FROM DATE '20201230');
> results to 53
>
> Version:
> PostgreSQL 10.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.3
> 20140911 (Red Hat 4.8.3-9), 64-bit
> on Amazon RDS
>
> Greetings from Hamburg, DE
>
> MiMo
>
>
Weeks start on Monday.

Weeks belong to the year in which they have the most days.

Cheers,
Gavin

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2018-07-04 18:30:55 Re: NOTIFY does not work as expected
Previous Message Félix GERZAGUET 2018-07-04 14:14:13 Re: Year 2024: Extracting week from date gives wrong results for the last two days of the year