# Date\_histogram offset results in wrong date \[6.2\]

**URL:** <https://discuss.elastic.co/t/date-histogram-offset-results-in-wrong-date-6-2/187347>\
**Category:** Elasticsearch\
**Created:** [June 25, 2019, 1:42pm UTC](https://discuss.elastic.co/t/date-histogram-offset-results-in-wrong-date-6-2/187347 "2019-06-25T13:42:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexfritz](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alexfritz](https://discuss.elastic.co/u/alexfritz)\
**Post date:** [June 25, 2019, 1:42pm UTC](https://discuss.elastic.co/t/date-histogram-offset-results-in-wrong-date-6-2/187347/1 "2019-06-25T13:42:20Z")

</div>

No one answered [this topic](https://discuss.elastic.co/t/difference-in-the-buckets-while-using-offset-in-date-histogram/156294), but I am experiencing the same problem. Is there an explanation or solution for this?

```
{
"size": 0,
"query": {
    "range": {
        "@timestamp": {
            "gte": "now/d",
            "lte": "now/d+1d",
            "time_zone": "+02:00"
        }
    }
},
"aggs": {
    "chartdata": {
        "date_histogram": {
            "field": "@timestamp",
            "interval": "day",
            "time_zone": "+02:00",
            "offset": "+6h"
        },....

```

The result is: "key\_as\_string": "2019-06-24T06:00:00.000+02:00",  
Expected result: "key\_as\_string": "2019-06-25T06:00:00.000+02:00",

---

<div class="post-metadata">

**Author:** ![alexfritz](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alexfritz](https://discuss.elastic.co/u/alexfritz)\
**Post date:** [July 9, 2019, 9:23am UTC](https://discuss.elastic.co/t/date-histogram-offset-results-in-wrong-date-6-2/187347/2 "2019-07-09T09:23:51Z")

</div>

I know understood why ES has this behaviour. I added a must\_not filter to exclude the data before the offset.

---

<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 6, 2019, 9:24am UTC](https://discuss.elastic.co/t/date-histogram-offset-results-in-wrong-date-6-2/187347/3 "2019-08-06T09:24:08Z")

</div>

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