From: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
---|---|
To: | "W(dot)B(dot)Hill" <bill(at)hillzaa1(dot)miniserver(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Inconsistant DOW... |
Date: | 2004-06-28 17:02:01 |
Message-ID: | 20040628170201.GJ550@quartz.newn.cam.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Jun 28, 2004 at 04:23:25PM +0000, W.B.Hill wrote:
> Hiya!
>
> What's happening, where've I goofed?
>
> CREATE TABLE test (d date);
Try using
CREATE TABLE test (d timestamp without timezone);
instead..
> 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???
Different times because of summer time starting before or after Ash
Wednesday, times because of implicit type casting - what is the
type of date + interval ?
> 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.
I'd try adding 46 days ago ;)
Cheers,
Patrick
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2004-06-28 17:02:56 | Slony-I Canada Day Release Candidate available |
Previous Message | Richard Huxton | 2004-06-28 17:01:47 | Re: Inconsistant DOW... |