On Mon, Jan 27, 2003 at 21:53:27 +0100,
joost(at)snow(dot)nl wrote:
> hi,
>
> last year (2002) the date december 31st is in week 1 of 2003.
>
> it is not possible to get this out of a date-column using EXTRACT or
> to_char.
> to_char( '2002-12-31', 'WW' ) returns 1, and
> to_char( '2002-12-31', 'YYYY' ) returns 2002 (as expected)!
It is POSSIBLE to do. You can use the fact that the Thursday of a week
is always in the same year as the week number refers to, to get the
correct year. It isn't pretty though and it probably is a good idea to
have a simple way to get the year corresponding to an ISO week.