Time groups showing off by one day in postgresql query

189 Views Asked by At

I have a query where I compute various statistics and metrics, and group by dates in the last week. The times do not have a time zone associated with them, but are displayed in UTC so I want to convert them to Pacific time first. When I get dates that are within 7 days of the current date, it only gives the 6 groups that represent the last 6 days. How come this is the case and how do I fix this? Thanks!

select
 date_trunc('day', time1 AT TIME ZONE 'US/Pacific') as day,
 ...
where is_displayed = 'yes'
 date_trunc('day', time1 AT TIME ZONE 'US/Pacific') >= now() - interval '7 days'
group by day;
0

There are 0 best solutions below