select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / DATE/TIME FUNCTIONS AND OPERATORS

Subtract arguments, producing a “symbolic” result that uses years and months, rather than just days

Signatures & examples

age ( timestamp, timestamp ) → interval
Subtract arguments, producing a symbolic result that uses years and months, rather than just days
age(timestamp '2001-04-10', timestamp '1957-06-13') → 43 years 9 mons 27 days
age ( timestamp ) → interval
Subtract argument from current_date (at midnight)
age(timestamp '1957-06-13') → 62 years 6 mons 10 days
age ( xid ) → integer
Returns the number of transactions between the supplied transaction id and the current transaction counter.
Version history 3
  1. PG 12 → 13changed
  2. PG 9.6 → 10changed
  3. PG 9.3 → 9.4changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source