Multiple time zones in a single dashboard

  • What Grafana version and what operating system are you using?
    Grafana v7.5.6 (5fdad5bfe4)

  • What are you trying to achieve?
    I have time-series data from two sources: one is providing timestamps in apparently any time zone, the other one in UTC. If I keep the dashboard time selector to EST (local time), then there is a gap on the right of the UTC dashboard, but all fine for the regular dashboard.

    If I change the dashboard time range to consider UTC time, this panel will correct itself (shift to the right), and the other panel stays the same. This allows me to correlate the data and solves the main problem, but I am confused why I cannot use browser time / EST in the same manner and have the data still correlated. Why does changing the dashboard time range shift one panel but not the other? (They are different data sources)

  • How are you trying to achieve it?
    I tried to use the “time shift” query options in the offset panel to no avail, it would move the visible window of data but it would still be “shifted” to the left

  • What did you expect to happen?
    I hope that I can line up the graphs all the way to the right with any time zone.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    If I use “local” browser time (EST) in the dashboard time range, these are the last timestamps returned from both panels in the data inspector:

2021-08-24 14:29:00
2021-08-24 10:29:00 -- this is the offset graph

You can see they are off by the expected amount. If I change the dashboard time range to UTC, the last timestamps are now the same:

2021-08-24 14:37:00
2021-08-24 14:37:00 -- now they are both the same
1 Like

I think you want to offset the time, I think the Graphs are forced to UTC even when not selected, and Grafana always expects UTC

I noticed this with trying to view the last Hour of data when i knew data was in the DB but Grafana shows nothing

I found this solution, Select Local browser Timezone, Shift your time data by UTC and shift the Time Filter by UTC offset the other direction

This is for MS SQL so I’m sorry if it’s no use


SELECT dateadd(hour, @offset, [TestExecutedAt]) as ‘time’

WHERE [TestExecutedAt] Between dateadd(hour, -@offset, $__timeFrom())
AND dateadd(hour, -@offset, $__timeTo())


@T_GrumpyEngineer thanks for sharing your suggestion. I think the MSSQL workaround you propose would work if the timestamps don’t have an explicit timezone set. Otherwise, if the timezone is set correctly, Grafana generally handles them in a very sane way.

@zeepeeare can you share what datasource(s) you’re using? Is it a timeseries database (Influx, Prometheus, …), or SQL?

Queries on timeseries databases always yield UTC-timestamped data. Grafana will convert this to the browser time (or whatever timezone is selected in the time picker), and assuming that the source data was timestamped correctly, what is shown should be correct.

SQL databases are a bit more nuanced. Mainly because the timestamp/datetime field can include a timezone - but it might not. If the field type does not include an explicit timezone, then all sorts of funky stuff can happen - and if I had to guess, I suspect that this is what you might be experiencing @zeepeeare. Off the top of my head, I’m not actually sure how Grafana treats datetimes without a timezone (but may well assume it’s UTC). I would recommend always explicitly including a timezone with any timestamps - to make them ISO 8601 compatible - or storing them as numerical Unix epoch values (implicitly UTC).

1 Like

I wasn’t bashing Grafana, just I’m just dealing with MSSQL in a job for last 11 months so haven’t really have had time to change old data sources.

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.