Charts are not built for a time range other than the last 6 hours

I have a table machines_records_full in MySQL

describe machines_records_full;

describe

I’m trying to build a graph in Grafana for the last 6 hours:

SELECT
  time AS "time",
  lamp,
  tube
FROM machines_records_full
WHERE
  time BETWEEN FROM_UNIXTIME($__unixEpochFrom()) AND FROM_UNIXTIME($__unixEpochTo()) AND
  machine_id = 1
ORDER BY time;


Everything works well

But when I select a different time period, for example, for the last 15 minutes, the graph is not displayed

Although the request to MySQL returns data:

is your time column utc?

1 Like

Indeed, I solved the problem using the time zone in the request in Grafana

SELECT
  CONVERT_TZ(time, '+03:00', '+00:00') AS "time",
  lamp,
  tube
FROM machines_records_full
WHERE
  time BETWEEN FROM_UNIXTIME($__unixEpochFrom()) AND FROM_UNIXTIME($__unixEpochTo()) AND
  machine_id = 1
GROUP BY time
ORDER BY time;

1 Like

will that work for daylight savings time? +03:00 seems very static
Should it not be something like this?

convert_tz(time,'US/Eastern','UTC') and specifying your TZ