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