group data by hour of day for the month postgresql code example Example: postgresql group by month and year date_trunc('month', col_date)