From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | d(dot)percevault(at)pnsconcept(dot)fr |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Strange behavior with to_char and dates |
Date: | 2009-01-09 14:46:54 |
Message-ID: | 4967635E.1000306@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Denis Percevault wrote:
> As you can see below,
> the request "to_char((current_date - 11), 'DD MM IYYY')" gives "29 12 2009" instead of "29 12 2008". With 12 or with 8 the result is
> good.
What you want is 'YYYY' instead of 'IYYY'. 'IYYY' is intended to be used
together with 'IW' and 'ID', to give a so-called "ISO week date". See
manual for more information, particularly this note:
> Attempting to construct a date using a mixture of ISO week and Gregorian date fields is nonsensical, and could yield unexpected results. In the context of an ISO year, the concept of a 'month' or 'day of month' has no meaning. In the context of a Gregorian year, the ISO week has no meaning. Users should take care to keep Gregorian and ISO date specifications separate.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | David Slayter | 2009-01-09 19:57:39 | BUG #4608: postgresql.conf and other .conf not created |
Previous Message | Denis Percevault | 2009-01-09 14:18:12 | Strange behavior with to_char and dates |