> > Why does the Netherlands (or at least my RH5.2 timezone database)
> > think you switch to DST on March 26?
> Hmmmm, maybe because we actually switched on march 26? In fact, whole of
> europe did AFAIK....
How quaint ;) The US switches this next weekend, which pushes it into
April. So it didn't occur to me that it was a DST issue at first.
And, I got off on the wrong track suggesting a solution. Having a
date_part() which works on dates explicitly doesn't really address the
issue, since you are trying to do the date_part() on a time interval,
not on an absolute date. And the time interval probably *should* keep
track of hours etc.
However, we *do* have an explicit subtraction operator for dates,
which returns a difference in days, which may be what you want:
postgres=# select '3-27-2000'::date-'3-6-2000'::date as days;
Or, force the type of the timestamp field to be date:
date('3-27-2000'::timestamp)-date('3-6-2000'::timestamp) as days;
And, if you still want to do the arithmetic using timestamps, you can
force the evaluation of the input into the *same* timezone, as in this
postgres=# select date_part('day',
'3-27-2000 CET'::timestamp-'3-6-2000 CET'::timestamp) as days;
I'm no longer thinking that an explicit date_part() for date or time
types will be useful.
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California
In response to
pgsql-hackers by date
|Next:||From: Billy G. Allie||Date: 2000-03-31 19:39:14|
|Subject: int8.c compile problem on UnixWare 7.x|
|Previous:||From: Maarten Boekhold||Date: 2000-03-31 15:38:03|
|Subject: Re: 6.5.0 datetime bug?|