...
You can use the "AGE" function or date subtraction to find the time elapsed between two dates. In these example, we are using "CURRENT_DATE" as one of the dates, but you can use any two date fields, cast as the same data type.
AGE (CURRENT_DATE, table.field_name) AS time_elapsed
...
- The Age function will show the results broken down into time components: Example: 10 mons 2 days 07:15:12.524
- The date subtraction function will show the number of days, if the two dates you're subtracting are cast as "DATE": Example: 309
- When the dates you're subtracting are in another date format (such as timestamptz), the results will show time components, which may be useful (or not). Example: 308 days 07:15:12.524