pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: olivier.delemar@free.fr
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year
Date: Mon, 6 Jan 2020 10:12:06 +0100
Message-ID: <f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net> (raw)
In-Reply-To: <16192-0a7c830763891773@postgresql.org>
References: <16192-0a7c830763891773@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');





view thread (2+ messages)

Message-ID: <f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net>
Permalink:  ../f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net/
Also on:    postgresql.org/message-id/f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: spam_eater@gmx.net, olivier.delemar@free.fr
  Subject: Re: BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year
  In-Reply-To: <f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net>
  References: <16192-0a7c830763891773@postgresql.org> <f7f280cf-a525-1928-892b-c24b4d9a2924@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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