Re: Formatting intervals.. - Mailing list pgsql-sql

From Christoph Haller
Subject Re: Formatting intervals..
Date
Msg-id 3E75C7BE.5BFE8C6C@rodos.fzk.de
Whole thread Raw
In response to Formatting intervals..  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Responses Re: Formatting intervals..  (Rajesh Kumar Mallah <mallah@trade-india.com>)
Re: Formatting intervals..  (Tomasz Myrta <jasiek@klaster.net>)
List pgsql-sql
> >
> > Is it possible to customize  interval display.
> >
> > eg,
> >
> > tradein_clients=# SELECT  cast ('10-10-1999'::timestamp -
'1-1-1999'::timestamp AS interval);
> > +----------+
> > | interval |
> > +----------+
> > | 282 days |
> > +----------+
> > (1 row)
> >
> > can i display it in months and days..
> It doesn't make sense. You don't have whole date, so how long should
> month be? 28? 29? 30? 31?
>
It does. As long the months between January and October are.
So
select age ('10-10-1999'::timestamp , '1-1-1999'::timestamp ) ;     age
---------------9 mons 9 days
(1 row)

Regards, Christoph




pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: Formatting intervals..
Next
From: Rajesh Kumar Mallah
Date:
Subject: Re: Formatting intervals..