# Aggregation based on hour of day and timezone

**URL:** <https://discuss.elastic.co/t/aggregation-based-on-hour-of-day-and-timezone/110445>\
**Category:** Elasticsearch\
**Created:** [December 6, 2017, 2:02am UTC](https://discuss.elastic.co/t/aggregation-based-on-hour-of-day-and-timezone/110445 "2017-12-06T02:02:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![beng](https://avatars.discourse-cdn.com/v4/letter/b/b3f665/32.png) [@beng](https://discuss.elastic.co/u/beng)\
**Post date:** [December 6, 2017, 2:21pm UTC](https://discuss.elastic.co/t/aggregation-based-on-hour-of-day-and-timezone/110445/2 "2017-12-06T14:21:51Z")

</div>

I found some useful information at [Is it possible to apply a timezone to a date in a scripted field?](https://discuss.elastic.co/t/is-it-possible-to-apply-a-timezone-to-a-date-in-a-scripted-field/65372) but it seems this approach is not best practice and has been deprecated.

I then stumbled upon [https://stackoverflow.com/a/46830875](https://stackoverflow.com/a/46830875) and was able to get it working with a small tweak 🙂

Just not sure how well this will scale.

---

_[View the full topic](https://discuss.elastic.co/t/aggregation-based-on-hour-of-day-and-timezone/110445)._
