reftime="$(date +"%T")" # Use actual time as reference through whole script refdate="$(date -Idate)" # Use actual time as reference through whole script insertdate ...
DATE_TRUNC('month', d)::date AS month_start, -- First day of the month DATE_TRUNC('year', d)::date AS year_start, -- First day of the year EXTRACT(YEAR FROM d)::int ...