Preset Time interval incorrect when used with time function $__timeGroup()

Hi there,

Really enjoy using Grafana as means to monitor live data for our team

I am using Grafana version 6.6.1 with MSSQL Server data source.

I have started using the time functions such as $__timeGroup and have found that the selection of preset time intervals at the top right menu doesn’t correspond to what I expect.

In the example I have screen shots for:

  1. The SQL Query
  2. The Grafana generated SQL Query - in which you will see what time criteria is generated

The preset time chosen - Last 6 hours
The computer time - in this instance about 11:35am 05 Mar 2020

When you look at the Grafana generated SQL it is showing time interval BETWEEN ‘2020-03-04T18:45:23Z’ AND ‘2020-03-05T00:45:23Z’ (This after selecting last 6 hours)

I would have expected this to be relative to my time and should be ‘2020-03-05T05:35:23Z’ AND ‘2020-03-05T11:35:23Z’ (i.e last 6 hours from when current time.)

I have used both UTC and browser Time Timezone but doesn’t make a difference.

When I apply it manually by selecting date from the calendar it applies the time interval correctly from 12AM on the start date up to 23:59:59 of the end date.

SQL Query
image