# Curl result of a time range query is 8 hours earlier which is not my timezone

**URL:** <https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688>\
**Category:** Logstash\
**Created:** [July 3, 2019, 10:35am UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688 "2019-07-03T10:35:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmk1995](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mmk1995](https://discuss.elastic.co/u/mmk1995)\
**Post date:** [July 3, 2019, 10:35am UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688/1 "2019-07-03T10:35:42Z")

</div>

Hello all,  
I am trying with the below simple search query in Kibana:

> ```
> POST /esd-dhcplog*/_search
> {
> "query": {
> "bool": {
> "must": [
> {
> "range": {
> "received_at": {
> "gte": "2019-07-03 10:00:00",
> "lte": "2019-07-03 18:00:00",
> "format": "yyyy-MM-dd HH:mm:ss"
> }
> }
> },
> {
> "match": {
> "clientIP": "10.32.66.28"
> }
> }
> ]
> }
> }
> }
> 
> ```

However, it ended up returning the result which is not UTC+8(my timezone).  
The documents shows in Kibana is the correct time which I know Kibana will do the change for me but the query result is changed back to UTC time, so the result is not correct.  
How can I fix this? And in the future, I am not using Kibana to curl but a Java app, is it a problem in that situation also?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 3, 2019, 1:13pm UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688/2 "2019-07-03T13:13:23Z")

</div>

elasticsearch works in UTC. The client is responsible for adjusting times to the local timezone. For Kibana, Kibana does it. For your Java app, the app must do it.

---

<div class="post-metadata">

**Author:** ![mmk1995](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mmk1995](https://discuss.elastic.co/u/mmk1995)\
**Post date:** [July 4, 2019, 2:46am UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688/3 "2019-07-04T02:46:30Z")

</div>

Can I minus 8 hours in time range like below?

> "received\_at": {  
> "gte": "2019-07-03 10:00:00" - 8,  
> "lte": "2019-07-03 18:00:00" - 8,  
> "format": "yyyy-MM-dd HH:mm:ss"  
> }

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [July 4, 2019, 1:21pm UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688/4 "2019-07-04T13:21:44Z")

</div>

That is an elasticsearch question, and you should ask it in that forum.

---

<div class="post-metadata">

**Author:** ![Juanma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juanma/32/49076_2.png) [@Juanma](https://discuss.elastic.co/u/Juanma)\
**Post date:** [July 4, 2019, 2:04pm UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688/5 "2019-07-04T14:04:48Z")

</div>

Hello @mmk1995

Please try to mark correctly the posts you have marked this one as "logstash" when its clearly about elasticsearch as other users told you.

As you can see at [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html#range-query-field-params](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html#range-query-field-params)

You have the parameter "time\_zone" which one you allows you set the timezone of the query response.

I hope this helps. 🙂

---

<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:** [August 1, 2019, 2:04pm UTC](https://discuss.elastic.co/t/curl-result-of-a-time-range-query-is-8-hours-earlier-which-is-not-my-timezone/188688/6 "2019-08-01T14:04:57Z")

</div>

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