# Applying timezones after results

**URL:** <https://discuss.elastic.co/t/applying-timezones-after-results/320>\
**Category:** Elasticsearch\
**Created:** [May 7, 2015, 1:02am UTC](https://discuss.elastic.co/t/applying-timezones-after-results/320 "2015-05-07T01:02:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlchai](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mlchai](https://discuss.elastic.co/u/mlchai)\
**Post date:** [May 7, 2015, 1:02am UTC](https://discuss.elastic.co/t/applying-timezones-after-results/320/1 "2015-05-07T01:02:55Z")

</div>

I want to return some data for the month of April using a date histogram, with the PST timezone applied. The data comes back like this:

{"buckets"=\>  
[{"key\_as\_string"=\>"2015-03-01", "key"=\>1425193200000, "doc\_count"=\>35},  
{"key\_as\_string"=\>"2015-04-01", "key"=\>1427871600000, "doc\_count"=\>4660}]}

I do not want the first hash since it's referring to March. I want the results to be compiled just into April. I've tried playing around with pre/post timezones and offsets and nothing seems to be working. How can I do what I want without manually doing it in application code?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 7, 2015, 7:07am UTC](https://discuss.elastic.co/t/applying-timezones-after-results/320/2 "2015-05-07T07:07:42Z")

</div>

I haven't looked at this code recently but the time\_zone option should do the job? Ie. `"time_zone": "-08:00"` on the date\_histogram.

---

<div class="post-metadata">

**Author:** ![mlchai](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mlchai](https://discuss.elastic.co/u/mlchai)\
**Post date:** [May 7, 2015, 4:22pm UTC](https://discuss.elastic.co/t/applying-timezones-after-results/320/3 "2015-05-07T16:22:39Z")

</div>

It applies it correctly for the calculation but after playing around with it, I can't seem to get it to consolidate all my results into just 1 month. Since I use PST, it'll always have the last few hours of the previous month.

---

<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:** [July 6, 2017, 12:15am UTC](https://discuss.elastic.co/t/applying-timezones-after-results/320/4 "2017-07-06T00:15:11Z")

</div>


