odd date behavior - Mailing list pgsql-general

From Gregory Seidman
Subject odd date behavior
Date
Msg-id 20020613184645.GA15815@cs.brown.edu
Whole thread Raw
List pgsql-general
The first day of the week, day 0, is Sunday. Or is it Monday? If I use
extract (dow from date) it will give me 0 for Sunday, but if I use extract
(week from date) the weeks start on Mondays. Observe:

template1=> SELECT extract (week from '2002-06-01'::date), extract (week from '2002-06-02'::date), extract (week from
'2002-06-03'::date);
 date_part | date_part | date_part
-----------+-----------+-----------
        22 |        22 |        23
(1 row)

template1=> SELECT extract (dow from '2002-06-01'::date), extract (dow from '2002-06-02'::date), extract (dow from
'2002-06-03'::date);
 date_part | date_part | date_part
-----------+-----------+-----------
         6 |         0 |         1
(1 row)

template1=> select version();
                           version
-------------------------------------------------------------
 PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96

Is this the expected behavior? Where is it documented? Can it be changed?

--Greg


pgsql-general by date:

Previous
From: Neil Conway
Date:
Subject: Re: Contrib reindex script:
Next
From: tony
Date:
Subject: read this and puke