bug with >to_char('2007-12-31'::DATE, 'YYYYIW')<

Started by Daniel Schuchardtover 18 years ago3 messagesgeneral
Jump to latest
#1Daniel Schuchardt
daniel_schuchardt@web.de

LOLL2=# SELECT to_char('2007-12-31'::DATE, 'YYYYIW');
to_char
---------
200701
(1 row)

2007-12-31 should be week 2008-01

regards,

Daniel.

#2Daniel Schuchardt
daniel_schuchardt@web.de
In reply to: Daniel Schuchardt (#1)
Re: bug with >to_char('2007-12-31'::DATE, 'YYYYIW')<

BTW:

Windows 2003 Server.

LOLL2=# SELECT version();

version
--------------------------------------------------------------------------------
PostgreSQL 8.1.4 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC)
3.4.2 (mingw-special)
(1 row)

Regards :)

Daniel Schuchardt schrieb:

Show quoted text

LOLL2=# SELECT to_char('2007-12-31'::DATE, 'YYYYIW');
to_char
---------
200701
(1 row)

2007-12-31 should be week 2008-01

regards,

Daniel.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniel Schuchardt (#1)
Re: bug with >to_char('2007-12-31'::DATE, 'YYYYIW')<

Daniel Schuchardt <daniel_schuchardt@web.de> writes:

LOLL2=# SELECT to_char('2007-12-31'::DATE, 'YYYYIW');
to_char
---------
200701
(1 row)

2007-12-31 should be week 2008-01

No, it shouldn't. YYYY is defined to deliver calendar year.
For ISO year use IYYY.

regards, tom lane