timespan weirdness (fwd)

From: Marin D <marin(at)cybernet(dot)bg>
To: pgsql-sql(at)postgresql(dot)org
Subject: timespan weirdness (fwd)
Date: 1998-06-02 07:36:58
Message-ID: Pine.LNX.3.96.980602103644.6811E-100000@server.iclub.techno-link.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi!

I need some help on the following timspan results:

create table test(d date);
insert into test values('1-5-98'); // European format

test=> select * from test;
d
----------
01-05-1998
(1 row)

// this is OK

test=> select date(datetime(d) + '1 month'::timespan) from test;
date
----------
01-06-1998
(1 row)

// this is OK

test=> select date(datetime(d) + '5 months'::timespan) from test;
date
----------
01-10-1998
(1 row)

// Ooops!

test=> select date (datetime(d) + '6 months'::timespan) from test;
date
----------
31-10-1998
(1 row)

// Ok too...

test=> select date (datetime(d) + '13 months'::timespan) from test;
date
----------
01-06-1999
(1 row)

Any comments?

Than for your help!

Marin

-= Why do we need gates in a world without fences? =-

Browse pgsql-sql by date

  From Date Subject
Next Message Herouth Maoz 1998-06-02 07:54:03 Re: [SQL] soundex more or less exact
Previous Message Walt Bigelow 1998-06-01 22:49:13 problem with the 'date' data type and msaccess95 :(