How to make Time Grain in Chart calculate day based on local time zone
I have a postgresql table with colume like this: create_time timestamp without time zone resource_id varchar(32)
Then I set the chart like this:

I found in super set log , the sql is like this: SELECT DATE_TRUNC('day', create_time) AS __timestamp, count(resource_id) AS "COUNT(resource_id)" FROM dbadmin.de_billing WHERE create_time >= '2020-03-29 00:00:00' AND create_time <= '2020-04-29 00:00:00' GROUP BY DATE_TRUNC('day', create_time) ORDER BY "COUNT(resource_id)" DESC LIMIT 50000
which means Time Grain calculate the day in this way : DATE_TRUNC('day', create_time) , for example : UTC 2020-04-28 00:00:00 to UTC 2020-04-29 00:00:00
But what I want is showing the count of resource_id every day based on local timezone my local time zone is Asia/Shanghai, which is utc+8 hour so I want it calculate in this way , for example, UTC 2020-04-27 16:00:00 to UTC 2020-04-28 16:00:00 , which means local time 2020-04-28 00:00:00 to local time 2020-04-29 00:00:00, the day of the local time
First I tried this way: add a new calculated columu , e8_create_time = create_time + INTERVAL '8 hour'
,then select the e8_create_time as the time colume in chart.

But I have a lot of tables! This method is very complex, I must add one or more new colomn for every table!
The I found in table settings there is a offset setting, But it did not work as I want,
when I set 8 here, it seems not calculate a whole day from 00:00:00 to 00:00:00, it shows 08 AM here

I search this question on internet , many anserwers say set superset config.py DRUID_TZ = tz.gettz('Asia/Shanghai'), but I did not use druid as the datasource, My database is here and druid datasources is empty

Is there a better way to achieve my goal? Thanks!!!
anyone help?
Which database do you use? Maybe in the extra field you could set the timezone.

Let me know what db you use and I can try to find the answer. Every database is different,
@eugeniamz I use the postgresql
You can update the base query for the data source. Go to sources > Tables > Edit record and under SQL, add:
SELECT *, create_time at time zone 'Asia/Shanghai' at time zone 'utc' as create_time_zone
FROM dbadmin.de_billing;
and the column create_time_zone will be available for all charts using that source.
So you use that instead of create_time in your charts.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.