# Adding timezone to kibana watcher

**URL:** <https://discuss.elastic.co/t/adding-timezone-to-kibana-watcher/206114>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [November 1, 2019, 4:30am UTC](https://discuss.elastic.co/t/adding-timezone-to-kibana-watcher/206114 "2019-11-01T04:30:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shan\_Chathusanda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shan_chathusanda/32/55382_2.png) [@Shan\_Chathusanda](https://discuss.elastic.co/u/Shan_Chathusanda)\
**Post date:** [November 1, 2019, 4:30am UTC](https://discuss.elastic.co/t/adding-timezone-to-kibana-watcher/206114/1 "2019-11-01T04:30:07Z")

</div>

Hi,  
Currently I am developing a kibana advanced watcher and I need to get an average value of items from the previous day. I used the time range query in watcher but the watcher only executes in UTC time. I use now-1d/d and now/d for the query. I need to execute this query in the server timezone. As the document here the timezone cannot be applied to now option. Is there any alternative way to add the timezone different to the range query?  
Thanks

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [November 1, 2019, 3:40pm UTC](https://discuss.elastic.co/t/adding-timezone-to-kibana-watcher/206114/2 "2019-11-01T15:40:53Z")

</div>

Watcher does not do anything special with how it executes the range query or date math. You

'now' will always be represented in UTC for date comparisons. The date it compares against is the field defined in the range field. [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html) and if your dates are not already stored in UTC, you can use the timezone to normalize them to UTC for correct date comparison.

As long as everything is based in UTC (now, and the date field used for the range), the comparisons should be correct, and you should be able to change the offset for range itself. For example if you want 24 range hours in GMT+2

```auto
 "gte": "now-22h/d",
 "lte": "now+2h/d"

```

I have not tested this, (and have a history of being wrong about time zones) so please test this. You should be able to use a normal range query to test then apply that to Watcher.

---

<div class="post-metadata">

**Author:** ![Shan\_Chathusanda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shan_chathusanda/32/55382_2.png) [@Shan\_Chathusanda](https://discuss.elastic.co/u/Shan_Chathusanda)\
**Post date:** [November 4, 2019, 4:26am UTC](https://discuss.elastic.co/t/adding-timezone-to-kibana-watcher/206114/3 "2019-11-04T04:26:07Z")

</div>

Hi @jakelandis,

Thank you for the reply. I thought in the same way and will test it.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 2, 2019, 4:26am UTC](https://discuss.elastic.co/t/adding-timezone-to-kibana-watcher/206114/4 "2019-12-02T04:26:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
