IYYY: unexpected behaviour

Started by Zubkovsky, Sergeyover 19 years ago2 messagesbugs
Jump to latest
#1Zubkovsky, Sergey
Sergey.Zubkovsky@transas.com

Hi,

SELECT to_char( '2006-01-01'::timestamp, 'IYYY-MM-DD' ) AS strange,

to_char( '2006-01-02'::timestamp, 'IYYY-MM-DD' ),

to_char( '2006-01-01'::timestamp, 'YYYY-MM-DD' );

does produce unexpected result for column 'strange':

strange | to_char | to_char

------------+------------+------------

2005-01-01 | 2006-01-02 | 2006-01-01

(1 row)

Is this a bug?

select version();

"PostgreSQL 8.2beta1 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC)
3.4.2 (mingw-special)"

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Zubkovsky, Sergey (#1)
Re: IYYY: unexpected behaviour

Zubkovsky, Sergey wrote:

SELECT to_char( '2006-01-01'::timestamp, 'IYYY-MM-DD' ) AS strange,
to_char( '2006-01-02'::timestamp, 'IYYY-MM-DD' ),
to_char( '2006-01-01'::timestamp, 'YYYY-MM-DD' );

does produce unexpected result for column 'strange':

strange | to_char | to_char
------------+------------+------------
2005-01-01 | 2006-01-02 | 2006-01-01

This is correct. January 1, 2006 belongs to 2005 in this "ISO" way of
counting.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/