pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year
2+ messages / 2 participants
[nested] [flat]
* BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year
@ 2020-01-06 08:39 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2020-01-06 08:39 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: olivier.delemar@free.fr
The following bug has been logged on the website:
Bug reference: 16192
Logged by: Olivier Delemar
Email address: olivier.delemar@free.fr
PostgreSQL version: 9.6.6
Operating system: Linux
Description:
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)
Temps : 152,799 ms
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year
@ 2020-01-06 09:12 Thomas Kellerer <spam_eater@gmx.net>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Kellerer @ 2020-01-06 09:12 UTC (permalink / raw)
To: olivier.delemar@free.fr; pgsql-bugs@lists.postgresql.org
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');
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-01-06 09:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 08:39 BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year PG Bug reporting form <noreply@postgresql.org>
2020-01-06 09:12 ` Thomas Kellerer <spam_eater@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox