date_part( units, timestamp )
Extract the given units out of a timestamp. The units value is a string and can be any of
the following values:
"day" "minute" "second" "year"
"hour" "month" "week" "dow"
"doy"
where:- "dow" returns the correct day of the week, for example, 1 for Sunday as the first day of the week, and 7 for Saturday as the last day of the week.
- "doy" returns the Julian day of the year, for example, 1 for the first day of the year, 365 or 366 for the last day of the year.
year = date_part("year", ts )
day = date_part("dow", ts)