Re: Inconsistant DOW...
От | Patrick Welche |
---|---|
Тема | Re: Inconsistant DOW... |
Дата | |
Msg-id | 20040628170201.GJ550@quartz.newn.cam.ac.uk обсуждение исходный текст |
Ответ на | Inconsistant DOW... ("W.B.Hill" <bill@hillzaa1.miniserver.com>) |
Список | 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
В списке pgsql-general по дате отправления: