I want to use date_trunc
function in PostgreSQL on my datetime column to aggregate data in a week.
For example I need to get number of sales each week.
The problem is date_trunc('week', datetime_column)
function considers Monday as the week start day and some of my customers user different start day in calendar (like Saturday).
I tried
SELECT date_trunc('WEEK',(time_id + interval '2 day'))- interval '2 day' AS WEEK
but it's messy and I think there must be a better way.