Time zone - Influx spread wrong time frame

I am using InfluxDB 1.7 and Grafana 8.4.6 hosted in the cloud.

All the line charts uses my browsers time (UCT+2).

The problem is now I do a query that shows the spread for the last day, now it calculates it on UCT and not on UCT+2, wrong time frame.

Can you adjust the time filter somehow? Well that is what I think needs to be adjusted to fix the query.

SELECT (spread(pulseNO)*0.3) FROM misol_weather  WHERE $timeFilter GROUP BY time(1d) fill(none)

image

Because your InfluxDB groups per UTC calendar day by default. InfluxDB returns 2022-09-18 00:00:00 timestamp for 2022-09-18 data. Grafana in your browser will move this timestamp to your browser timezone (UTC+2) => 2022-09-18 02:00:00. So it is still the same timestamp, but in different timezone. It is absolutely correct.

Set dashboard timezone to UTC if you want to see 00:00 instead of 02:00.
You can also set timezone offset for timegrouping on the InfluxQL level, but wouldn’t use, because that introduce another problems (e.g. Daylight Saving Time).

1 Like

Thank you the tz() works 100%. Luck I am not concerned about Daylight Saving Time, as we don’t have it.

Hi @Johan I wonder how you make this work?
When aggregating at “24h” or “1d” the timestamp always starts at 1st day + timeRegion to 2nd day + timeRegion (as you have mention here).
I tried the tz function in the query editor but seems like not working on me.
My grafana is running on Windows OS.