The age() function is documented as "Calculate time difference while
retaining year/month fields", but it doesn't seem to do anything different
from a plain date subtraction with a few time zone problems added in:
select age(date '1999-05-17', date '1957-06-13'); age
-------------------------------41 years 11 mons 3 days 23:00
(1 row)
peter=# select age(date '1999-05-17', date '1999-06-13'); age
-----------27 days
(1 row)
But then again, date subtraction has seen better days, too:
peter=# select date '1999-08-13' - date '1989-06-13';?column?
---------- 3713
(1 row)
peter=# select date '1999-08-13' - date '1999-06-13';?column?
---------- 61
(1 row)
As opposed to:
peter=# select timestamp '1999-08-13' - timestamp '1999-06-13';?column?
----------61 days
(1 row)
SQL sez date - date returns interval, btw.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/