From: | Joshua Moore-Oliva <josh(at)chatgris(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Division of intervals. |
Date: | 2003-03-19 06:03:50 |
Message-ID: | 200303190103.50683.josh@chatgris.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)chatgris(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Dennis Gearon | 2003-03-19 06:27:44 | Re: access primitives in php |
Previous Message | Joe Conway | 2003-03-19 05:58:42 | Re: access primitives in php |