In this article, we will cover the most commonly used PostgreSQL date and time functions that allows working with date and time values effectively.
In business scenarios where we need to calculate the ages of people, service tenure of employees, tenure of students in school/universities, etc., we can use the Age() function to achieve these tasks. The basic syntax is:
select AGE(timestamp,timestamp); Select AGE(timestamp):
In the first example, the AGE() function accepts two TIMESTAMP values in YYYY-MM-DD format. The second argument is subtracted from the first one and an interval is returned as result.
In the second