In today’s article, we will discuss the Age function in PostgreSQL, which calculates the difference in days, months, and years between two points in time.
The following illustrates the syntax of the AGE() function:
1 | AGE(timestamp,timestamp); |
Let’s make an example;
1 | select age(current_date,'1991.08.20') |
In the example above, we specify today’s date with the “current_date” parameter and any date in the second parameter to find the day, month and year difference between those dates.
1 |