Yet another timezone issue (yes I googled!)

  • What Grafana version and what operating system are you using?

Grafana 10.0.3 docker container
( & InfluxDb 2.7.1 docker container)

  • What are you trying to achieve?

My graphs (and such) to show up correctly

  • How are you trying to achieve it?

By using the grafana query builder for InfluxQl

  • What happened?

The time is off. The first 2 hours of my graph (various graph types) don’t show up. I also see that the query returns points 2 hours into the future if I add a ‘group by time(10m)’ for example.

  • What did you expect to happen?

I expected it to work…

  • Can you copy/paste the configuration(s) that you are having problems with?

Nothing special. Query:
SELECT “a” FROM “bucket” WHERE $timeFilter GROUP BY “b”::tag ORDER BY time DESC

  • What did I try?

I tried setting the time zone in grafana (top right) to UTC+2 (my timezone), UTC, and even UTC-4 (because why not) but with ANY of these, the first 2 hours don’t show up. Also, when looking at the table view I see that the points returned are shown in my local (UTC+2) time (even when selecting UTC time in grafana, which I felt was weird).

I also just tried messing around with the query builder and stuff, but nothing worked. Even using the timezone option in the query builder seemed to have no effect, even when using various different timezones in there.

Other than that I tried googling ofcourse, which is why I will say this: The timestamps in my InfluxDb ARE UTC!

1 Like

Welcome @koendubuf

Is the time field in your bucket a UTC date? How are you populating this data, would be good to see your code that populates this data

Grafana expects all dates to be utc if not in the actual table then using a function that converts to utc


As I mentioned, the time in my influxdb data is UTC.

I populate influxdb using a python script that boils down to this every minute:

with InfluxDBClient(url=if_url, token=if_token, org=if_org) as client:
    write_api = client.write_api(write_options=SYNCHRONOUS)
    write_api.write(bucket=ifdb, org=if_org, record={
        "measurement": "bucket",
        "tags": {
            "b": "something"
        "fields": {
            "a": get_measurement_int()
        "time": datetime.datetime.utcnow().isoformat()

This is the first sign that my influxdb data is UTC.
Other than this I also manually checked via the InfluxDb data explorer that the _time field is UTC.

1 Like

I found it!

It seems the host time of my server (and thus also the grafana & influxdb containers) was 2 hours off!

I would say influxdb only stores the time, so that should not matter, and grafana uses browser time, so that shouldn’t matter either. Thus I don’t know which of these 2 time offsets was the issue…

But it’s fixed! If anybody finds this: check your server time!
(bios should be utc, os should have local time)