Time shift in data, with timeseriesDB, data not displayed for their original time written to the DB

Hello, I am using Grafana with Postgres/timeseriesDB as the data source. I have put up a simple database. I am using timestamp without timezone on the DB. Yet, Grafana shows data with a time shift. This is the generated SQL from Grafana.

SELECT
“time” AS “time”,
health
FROM tenanthealthdata
WHERE
“time” BETWEEN ‘2020-04-27T11:25:03.055Z’ AND ‘2020-04-27T12:25:03.055Z’
ORDER BY 1

However data shows with a time shift as below. I tried changing timezone from settings and checked postgres server’s timezone as well. (I started quickly with this and did not have much knowledge.) Thanks!!!

The first question is, for the moment ignore the data and select a time range of Last Three Hours or something similar is. In this case is the time shown at the right hand end of the graph the correct local time?
If it is then almost certainly the problem is that you have saved timestamps in local time in the database instead of UTC. The timestamps in the database should be in UTC and grafana will convert to local time on display.

Yes, that works! thanks!!! (storing in UTC on the database)

Wow, usually this question (which recurs every few days at least) takes a dozen or so posts before the OP really understands the problem. :slight_smile:
Glad to be of help.