Re: BUG #3892: Invalid week determination

From: Magne Mæhre <Magne(dot)Mahre(at)Sun(dot)COM>
To: Roman <rk(at)infren(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3892: Invalid week determination
Date: 2008-01-21 12:40:23
Message-ID: 479492B7.1020503@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Roman wrote:
>
> I see in the doc: ( however it does not explain the case )
>
> week
> The number of the week of the year that the day is in. By definition (ISO
> 8601), the first week of a year contains January 4 of that year. (The
> ISO-8601 week starts on Monday.) In other words, the first Thursday of a
> year is in week 1 of that year. (for timestamp values only)
>

It's actually in the doc for the to_char() function. 'WW' uses a week
definition where January 1st is in week 1. If you use 'IW', you get
the ISO definition.

=> select to_char(now(),'yyyyIW');
to_char
---------
200804
(1 row)

=> select extract(week from now());
date_part
-----------
4

--Magne

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Christian Schröder 2008-01-21 13:48:58 Re: (possible) bug with constraint exclusion
Previous Message Euler Taveira de Oliveira 2008-01-21 12:35:11 Re: BUG #3891: Multiple UPDATE doesn't handle UNIQUE constraint correctly