# Date histogram aggregation returns a wrong number of buckets and wrong start date of each bucket

**URL:** <https://discuss.elastic.co/t/date-histogram-aggregation-returns-a-wrong-number-of-buckets-and-wrong-start-date-of-each-bucket/289324>\
**Category:** Elasticsearch\
**Created:** [November 16, 2021, 12:42pm UTC](https://discuss.elastic.co/t/date-histogram-aggregation-returns-a-wrong-number-of-buckets-and-wrong-start-date-of-each-bucket/289324 "2021-11-16T12:42:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 18, 2021, 10:04am UTC](https://discuss.elastic.co/t/date-histogram-aggregation-returns-a-wrong-number-of-buckets-and-wrong-start-date-of-each-bucket/289324/3 "2021-11-18T10:04:06Z")

</div>

I did not check in details, but you should make sure that the dates you are sending to Elasticsearch  
like `1636727017825 ` are UTC.  
If you are not using a proper date format with the timezone, then Elasticsearch considers the date as UTC based.

If it's not exactly the problem here, could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

Please replace the ms since epoch dates by a readable date so we can better understand what is happening.

A full reproduction script is something anyone can **copy and paste in Kibana dev console** , click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

_[View the full topic](https://discuss.elastic.co/t/date-histogram-aggregation-returns-a-wrong-number-of-buckets-and-wrong-start-date-of-each-bucket/289324)._
