Re: Division of intervals. - Mailing list pgsql-general

From Joshua Moore-Oliva
Subject Re: Division of intervals.
Date
Msg-id 200303190103.50683.josh@chatgris.com
Whole thread Raw
In response to Re: Division of intervals.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Division of intervals.  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
I guess that it does for this problem..  But I have other applications that
require the number of days...  and that gets a lot more complex to work out.

Are there any plans in the near future to add this functionality?

I had already through of this solution, but it appeared rather bulky to me,
but I guess that's all there is now thanks.

Josh.

On March 19, 2003 12:23 am, Tom Lane wrote:
> Joshua Moore-Oliva <josh@chatgris.com> writes:
> > I attempted
> > SELECT age(now(), timestamp '1957-06-13') / interval '1 month';
> > and got the error
> > ERROR:  Unable to identify an operator '/' for types 'interval' and
> > 'interval'
>
> I'm not sure division of intervals is sensible --- consider the
> recently-pointed-out issues about variable length of months, etc.
>
> Does this do what you want?
>
> regression=# SELECT extract(year from age(now(), timestamp '1957-06-13'));
>  date_part
> -----------
>         45
> (1 row)
>
> regression=# SELECT extract(month from age(now(), timestamp '1957-06-13'));
>  date_part
> -----------
>          9
> (1 row)
>
> regression=# SELECT extract(year from age(now(), timestamp '1957-06-13'))
> *12 regression-# + extract(month from age(now(), timestamp '1957-06-13'));
> ?column?
> ----------
>       549
> (1 row)
>
>
>             regards, tom lane


pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: access primitives in php
Next
From: Dennis Gearon
Date:
Subject: Re: access primitives in php