# 'now-1d/d' cannot work correctly

**URL:** <https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806>\
**Category:** Kibana\
**Created:** [April 7, 2020, 1:57am UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806 "2020-04-07T01:57:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Echo\_yu](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@Echo\_yu](https://discuss.elastic.co/u/Echo_yu)\
**Post date:** [April 7, 2020, 1:57am UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806/1 "2020-04-07T01:57:14Z")

</div>

Hi, i used logstash to load data from MSSQL database to Elasticsearch. Since I lost 8 hours each time I imported the time field, I manually added 8 hours, for example: I have a sql in conf file of logstash : `dateadd(hh,8,starttime) as starttime `.However when I use `now-1d/d` to search the data yesterday , I found it didnot work correctly . The data showed incomplete.How can I solve this problem ? Looking forward to your reply .Thanks!

---

<div class="post-metadata">

**Author:** ![Liza\_Katz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liza_katz/32/52358_2.png) [@Liza\_Katz](https://discuss.elastic.co/u/Liza_Katz)\
**Post date:** [April 7, 2020, 12:00pm UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806/2 "2020-04-07T12:00:24Z")

</div>

Hey @Echo_yu

Sounds like a timezone issue to me.  
Which app is this happening in?  
Can you share some screenshots of the incompletness?

---

<div class="post-metadata">

**Author:** ![Echo\_yu](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@Echo\_yu](https://discuss.elastic.co/u/Echo_yu)\
**Post date:** [April 7, 2020, 12:37pm UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806/3 "2020-04-07T12:37:55Z")

</div>

Hi，I wrote query in vega of kibana to get my data from elasticsearch, and i have to set the date range like this to get all of yesterday's data . And I did some search in Discover of kibana when i apply one of my date field time into filtter, i found it missing 8 hours!

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/7/0749254541483da3645e64be129cfe90dd125c59.png) [image|690x295](https://discuss.elastic.co/uploads/short-url/6PqNjRsvhtOZQRAe01tDo34YyfI.png) Could you give me some suggestions on this issues?Thanks!

---

<div class="post-metadata">

**Author:** ![Liza\_Katz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liza_katz/32/52358_2.png) [@Liza\_Katz](https://discuss.elastic.co/u/Liza_Katz)\
**Post date:** [April 7, 2020, 1:15pm UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806/4 "2020-04-07T13:15:01Z")

</div>

Just to make sure I understand:

- In your MYSQL you have a record with a date like this: `2020-04-05 19:00:00`
- And when ingesting it you added 8 hours, so now in ES you have `2020-04-06 03:00:00`
- Now you're running a query for the 5th (assuming today is the 6th) and you're using `now-1d`. The query gets all data for `2020-04-05 00:00:00` - `2020-04-05 23:59:59` and this record is not returned.

Correct?

---

<div class="post-metadata">

**Author:** ![Echo\_yu](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@Echo\_yu](https://discuss.elastic.co/u/Echo_yu)\
**Post date:** [April 8, 2020, 3:06am UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806/5 "2020-04-08T03:06:06Z")

</div>

Hi，in my db i have a record with a date like this: `2020-04-05 19:00:00` and i found it showed like this in the kibana: `2020-04-05 11:00:00`, so i manually added 8 hours to make it look the same as the time in my db with a sql: `dateadd(hh,8,startdatetime) as startdatetime` .Now i am running a query for the 5th(assuming today is the 6th) and i am using `gte:now-1d/d,lt:now+0d/d` but i cannot get all the data for `2020-04-05 00:00:00` - `2020-04-05 23:59:59` and when i add one of the value of startdatetime I found the filter time also change like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/5/251ae94fb053c51242eb5928aad6f21eb582ece7.jpeg)

---

<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:** [May 6, 2020, 3:06am UTC](https://discuss.elastic.co/t/now-1d-d-cannot-work-correctly/226806/6 "2020-05-06T03:06:22Z")

</div>

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