On Tue, 2002-10-01 at 03:31, Tom Lane wrote:
> Offhand this seems kinda inconsistent to me --- I'd expect
>
> regression=# select extract(week from date '2002-09-30');
> date_part
> -----------
> 40
> (1 row)
>
> to produce 39, not 40, on the grounds that the first day of Week 40
> is tomorrow not today. Alternatively, if today is the first day of
> Week 40 (as EXTRACT(week) seems to think), then ISTM that the to_date
> expression should produce today not tomorrow.
>
> I notice that 2001-12-31 is considered part of the first week of 2002,
> which is also pretty surprising:
There are at least 3 different ways to start week numbering:
1. from first week with any days in current year
2. from first full week in current year
3. from first week with thursday in current year
perhaps more...
I suspect it depends on locale which should be used.
---------------
Hannu