Inconsistant DOW... - Mailing list pgsql-general

From W.B.Hill
Subject Inconsistant DOW...
Date
Msg-id Pine.LNX.4.58.0406281616130.20175@uvyymnn1.zvavfreire.pbz
Whole thread Raw
Responses Re: Inconsistant DOW...
Re: Inconsistant DOW...
List pgsql-general
Hiya!

What's happening, where've I goofed?

CREATE TABLE test (d date);

INSERT INTO test(d) VALUES('11-Apr-2004');
INSERT INTO test(d) VALUES('27-Mar-2005');
INSERT INTO test(d) VALUES('16-Apr-2006');
INSERT INTO test(d) VALUES('08-Apr-2007');
INSERT INTO test(d) VALUES('23-Mar-2008');
INSERT INTO test(d) VALUES('12-Apr-2009');
INSERT INTO test(d) VALUES('04-Apr-2010');

SELECT * FROM test;
     d
------------
 2004-04-11
 2005-03-27
 2006-04-16
 2007-04-08
 2008-03-23
 2009-04-12
 2010-04-04
(7 rows)

SELECT date_part('dow',d) FROM test;
 date_part
-----------
         0
         0
         0
         0
         0
         0
         0
(7 rows)

This is good - every Easter's on a Sunday so far...

SELECT d+'45 days ago'::interval FROM test;
        ?column?
------------------------
 2004-02-25 23:00:00+00
 2005-02-10 00:00:00+00
 2006-03-01 23:00:00+00
 2007-02-21 23:00:00+00
 2008-02-07 00:00:00+00
 2009-02-25 23:00:00+00
 2010-02-17 23:00:00+00
(7 rows)

Why the different times??? Why the times???

SELECT date_part('dow',d+'45 days ago'::interval) FROM test;
 date_part
-----------
         3
         4
         3
         3
         4
         3
         3
(7 rows)

So, Ash Wednesday's on a Thursday iff Easter's in March???
Hmmm.

pgsql-general by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: Plperlu and sending emails, is it safe?
Next
From: Adam Ruth
Date:
Subject: Re: Group by - Case insensitivity