PostgreSQL AGE() function
The age() function subtract arguments, producing a "symbolic" result that uses years and months.
age(timestamp, timestamp) or age(timestamp)
Return Type: interval
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL AGE() function
Example 1: PostgreSQL AGE() function
The example below finds the age between two dates specified in the argument.
SELECT age(timestamp '2015-01-15', timestamp '1972-12-28');
age ------------------ 42 years 18 days (1 row)
The example below finds the age between current date and the date as specified in the argument.
SELECT age(timestamp '2007-10-07');
age ----------------------- 7 years 3 mons 7 days (1 row)
Many of our valued users post comments along with piece of code. Disqus may, false positively, consider those piece of code as Bad or Starnge syntax and send those comments to spam automatically. Even if that happens, we will make sure those useful comments are taken out of spam and approved. It may take a couple of days for that though, but any useful comment will be brought to public view for sure. We regret if that happend to any user. You may write us directly regarding this to - w3resource[at]yahoo[dot]com.