Skip to content

AGE

  • timestamp1: The timestamp to subtract from. When omitted, the current date at midnight is used.
  • timestamp2: The timestamp to subtract.
SELECT AGE(TIMESTAMP '2000-01-01');
age
------------------
21 years 10 mons

In the provided example, the AGE function in PostgreSQL is used to calculate the age between the current date and the specified date, ‘2000-01-01’. The result ‘21 years 10 mons’ shows the time difference in years and months.