Re: Re: Problem with Dates

Brett W. McCoy <bmccoy@chapelperilous.net>

From: "Brett W. McCoy" <bmccoy@chapelperilous.net>
To: Glen and Rosanne Eustace <agree@godzone.net.nz>
Cc: Mike Castle <dalgoda@ix.netcom.com>, <pgsql-sql@postgresql.org>
Date: 2001-01-25T02:59:36Z
Lists: pgsql-sql
On Thu, 25 Jan 2001, Glen and Rosanne Eustace wrote:

> pressie# select '31/12/2000'::date + '1 year'::timespan;
>           ?column?
> -----------------------------
>  01/01/2002 00:00:00.00 NZDT
> (1 row)
>
> pressie=#
>
> Well I do :-(
>
> I vaguely remember someone else having the same problem and it was
> something to do with daylight saving.  I don't recall the solution
> though, if there was one.

It might also have something to do with your timezone.  I did the exact
same query on my server and got the correct result:

cp=> select '31/12/2000'::date + '1 year'::timespan;
        ?column?
------------------------
 2001-12-31 00:00:00-05
(1 row)

cp=>

What happens if instead you add the days?

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
We are what we are.