...
extract (dow FROM li.loan_date) as day_of_week_number_using_extract
- Finding the elapsed time between two dates
You can use the "AGE" function or date subtraction to find the time elapsed between two dates.
AGE (CURRENT_DATE, table.field_name) AS time_elapsed
CURRENT_DATE::DATE - table.field_name::DATE AS days_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