Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aGPMA-00056O-Q4 for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Jan 2016 11:00:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aGPM9-0007yA-E7 for pgsql-bugs@arkaria.postgresql.org; Tue, 05 Jan 2016 11:00:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aGPLV-0007Cu-Rx for pgsql-bugs@postgresql.org; Tue, 05 Jan 2016 11:00:09 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aGPLQ-00082Q-KE for pgsql-bugs@postgresql.org; Tue, 05 Jan 2016 11:00:08 +0000 MIME-Version: 1.0 Subject: BUG #13845: Incorrect week number To: pgsql-bugs@postgresql.org From: kees.westerlaken@valuecare.nl Date: Tue, 05 Jan 2016 10:59:24 +0000 Message-ID: <20160105105924.1114.70550@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13845 Logged by: Kees Westerlaken Email address: kees.westerlaken@valuecare.nl PostgreSQL version: 9.2.10 Operating system: Linux Description: 2016 is a year where week numbers (US) differ from ISO. On 1 januari 2016 it works OK. select to_char(to_date('20160101', 'YYYYMMDD'), 'YYYYWW') produces 201601, while select to_char(to_date('20160101', 'YYYYMMDD'), 'YYYYIW') produces 201553. However on 4 januari 2016 select to_char(to_date('20160104', 'YYYYMMDD'), 'YYYYWW') produces 201601, which should be 201602 !! And surprisingly on 8 januari 2016, which is in the same week as 4 januari select to_char(to_date('20160108', 'YYYYMMDD'), 'YYYYWW') produces 201602, which is correct. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs