# Issue using $\_\_timeFilter()

**URL:** <https://community.grafana.com/t/issue-using-timefilter/16997>\
**Category:** MySQL\
**Tags:** mysql\
**Created:** [May 6, 2019, 4:44pm UTC](https://community.grafana.com/t/issue-using-timefilter/16997 "2019-05-06T16:44:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![simwalia](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@simwalia](https://community.grafana.com/u/simwalia)\
**Post date:** [May 6, 2019, 4:44pm UTC](https://community.grafana.com/t/issue-using-timefilter/16997/1 "2019-05-06T16:44:41Z")

</div>

Hi,

I am new to Grafana so look for guidance in the issue I have been having with $\_\_timeFilter().  
I am using Grafana with MySQL.  
Grafana version : 6.1.3

SQL:  
SELECT EHPT.EQUIP\_IDENT AS Equipment, HPT.HEALTH\_PROTOCOL\_TYPE AS HealthProtocolType, EQUIP.EQMODEL\_CODE AS ‘Equipment Type’, AT.START\_TIMESTAMP , AT.END\_TIMESTAMP AS ‘End Timestamp’, AP.NAME AS ‘Event’, AP.SEVERITY AS Severity  
FROM EQUIP\_HEALTH\_PROTOCOL\_TYPE EHPT WITH (NOLOCK)  
INNER JOIN ALARM\_TRANS AT WITH (NOLOCK)  
ON EHPT.EQUIP\_IDENT = AT.EQUIP\_IDENT  
INNER JOIN ALARM\_PROTOCOL AP  
ON (AT.ALARM\_PROTOCOL\_IDENT = AP.ALARM\_PROTOCOL\_IDENT AND AT.HEALTH\_PROTOCOL\_TYPE\_IDENT = AP.HEALTH\_PROTOCOL\_TYPE\_IDENT)  
WHERE  
$\_\_timeFilter(AT.START\_TIMESTAMP)  
AND EQMODEL\_CODE IN ($equipmodel)  
AND EHPT.EQUIP\_IDENT IN ($equipid)  
AND AP.SEVERITY IN ($severity)  
ORDER BY EHPT.EQUIP\_IDENT, AT.START\_TIMESTAMP

timeFilter() generates time in the following format:  
AT.START\_TIMESTAMP BETWEEN ‘2019-04-26T18:08:24Z’ AND ‘2019-05-03T18:08:24Z’

timeFilter() picks the dates selected in the time filters but because of the T and Z in the time, the report doesn’t render any result.

Need help figuring this out.

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [May 9, 2019, 1:03am UTC](https://community.grafana.com/t/issue-using-timefilter/16997/2 "2019-05-09T01:03:41Z")

</div>

This is a bit complicated, in my view,  
You have to start by looking at the time zone of your server-host, the default time zone of your database server and your grafana server 😴 then you would have to adjust it, and surely update the previous data.

If you give more details of these things maybe I can help you a little.

---

<div class="post-metadata">

**Author:** ![clanlaw](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@clanlaw](https://community.grafana.com/u/clanlaw)\
**Post date:** [May 9, 2019, 7:50am UTC](https://community.grafana.com/t/issue-using-timefilter/16997/3 "2019-05-09T07:50:46Z")

</div>

Also make sure that the timestamps you are putting into the db are in UTC.

---

<div class="post-metadata">

**Author:** ![simwalia](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@simwalia](https://community.grafana.com/u/simwalia)\
**Post date:** [May 10, 2019, 8:02pm UTC](https://community.grafana.com/t/issue-using-timefilter/16997/4 "2019-05-10T20:02:07Z")

</div>

The timezone on host server and influx db server is UTC. The timestamps into the db are in UTC as well.

---

<div class="post-metadata">

**Author:** ![clanlaw](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@clanlaw](https://community.grafana.com/u/clanlaw)\
**Post date:** [May 10, 2019, 8:51pm UTC](https://community.grafana.com/t/issue-using-timefilter/16997/5 "2019-05-10T20:51:19Z")

</div>

So why do you think the fact that the timeFilter is in UTC is causing a problem?
