Timezone doesn't work using SQL Server

Hello

I am new to Grafana. The first test I have done is to connect Grafana to a SQL Server to get data from a table to a grah. The issue is that it does it well, but it displaces the data in time. I think it shows them in UTC, and in my timezone it’s two hours less. The database is in local TZ and in the settings of the dashboards, in the timezone option, I have set local broser time, but it continues to show the hours (+ 2h) that it should show.

This is the query

SELECT
__timeGroup(DATE_OP, '1h') as time, count(*) as "Events" FROM operations_itt WHERE -- __timeFilter(DATE_OP) AND
ado = ‘TO’ and result=‘OK’
GROUP BY
$__timeGroup(DATE_OP, ‘1h’)
ORDER BY 1 asc

Thanks in advance
Antonio

If you select something like ‘Last 3 hours’ for display is the time shown at the right hand end of the graph your current local time? If so then grafana and the browser are correctly configured.
You say the timestamps in the database are in local time, if so then that is the problem, they should be in UTC. Timestamps in databases should always be in UTC. With them in local time what is going to happen when the DST state changes and the clocks go back. You will have overlaid data with the same timestamps.

You can work around the issue by using a devious query to correct the timestamps when you query the database, but of course that will not work when the DST state changes. The correct fix is to use UTC timestamps in the database. Grafana adjusts the data to your local timezone when it displays it.