Group UTC data to local time zone

  • What Grafana version and what operating system are you using?
    8.2.1 Home assistant OS

  • What are you trying to achieve?
    A bar graph of daily enery cost

I’m trying to get a daily maximum for a sensor but it shows the wrong value as the data is in UTC in InfluxDB and I’m in UTC+10.

I’ve tried changing my Grafana profile timezone to UTC but that makes no difference, it’s still showing the wrong maximum for the day.

So I’ve ended up grouping by time(1d,-10h) . This works perfectly but it is all going to come undone in a couple of months when we start daylight savings.

How do I group the UTC data in Influx to my local timezone days in Grafana?


You can use the tz() clause in influx (assuming you’re using InfluxQL and not Flux)

I am using InfluxQL, so this sounds perfect. Unfortunately I have been unable to find any relevant documentation on how to use tz().

Is this available in Grafana’s GUI, or will I have to use the raw query editor?

e.g. How would it be used for this?

SELECT last("value") FROM "$" WHERE ("entity_id" = 'total_cost_today') AND $timeFilter GROUP BY time(1d,-10h) fill(none)

EDIT: Never mind. Got it sorted. Thank you very much for your help.

Screenshot 2021-09-23 at 20-16-14 Grafana - Home Assistant

Cool, glad you got it sorted! Yes, it’s in the Grafana query builder (in recent versions of Grafana). The relevant Influx docs are here: Explore data using InfluxQL | InfluxDB OSS 1.8 Documentation

1 Like