# Quarter Time Range Problem

**URL:** https://discuss.elastic.co/t/quarter-time-range-problem/7379
**Category:** Elasticsearch
**Created:** [April 18, 2012, 1:32pm UTC](https://discuss.elastic.co/t/quarter-time-range-problem/7379 "2012-04-18T13:32:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)
#### Post date: [April 18, 2012, 1:32pm UTC](https://discuss.elastic.co/t/quarter-time-range-problem/7379/1 "2012-04-18T13:32:53Z")

</div>

Hi,  
I am using DateHistogram Facet for finding the Date Range. In  
my application I need to get the Quarter Value similar

SELECT QUARTER(Created\_DT) FROM TableName;

In MySQL it is taking

January to March as Quarter 1

April to June as Quarter 2

July to September as Quarter 3

October to December as Quarter 4

Is there any method in elasticsearch to find the Quarter Value  
similar to MySql?

Thanks in Advance!

Cheers!

George

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [April 19, 2012, 2:41pm UTC](https://discuss.elastic.co/t/quarter-time-range-problem/7379/2 "2012-04-19T14:41:32Z")

</div>

There isn't one, but you can do a date histogram facet on months and  
aggregate the values to quarters yourself.

On Wed, Apr 18, 2012 at 4:32 PM, George Viju [vijuitech@gmail.com](mailto:vijuitech@gmail.com) wrote:

> Hi,  
> I am using DateHistogram Facet for finding the Date Range. In  
> my application I need to get the Quarter Value similar
> 
> SELECT QUARTER(Created\_DT) FROM TableName;
> 
> In MySQL it is taking
> 
> January to March as Quarter 1
> 
> April to June as Quarter 2
> 
> July to September as Quarter 3
> 
> October to December as Quarter 4
> 
> Is there any method in elasticsearch to find the Quarter Value  
> similar to MySql?
> 
> Thanks in Advance!
> 
> Cheers!
> 
> George

---

<div class="post-metadata">

### Author: ![vijuitech](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@vijuitech](https://discuss.elastic.co/u/vijuitech)
#### Post date: [April 20, 2012, 3:46am UTC](https://discuss.elastic.co/t/quarter-time-range-problem/7379/3 "2012-04-20T03:46:59Z")

</div>

Thank You Shay!

Cheers!

George

On Apr 19, 7:41 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> There isn't one, but you can do a date histogram facet on months and  
> aggregate the values to quarters yourself.
> 
> On Wed, Apr 18, 2012 at 4:32 PM, George Viju [vijuit...@gmail.com](mailto:vijuit...@gmail.com) wrote:
> 
> > Hi,  
> > I am using DateHistogram Facet for finding the Date Range. In  
> > my application I need to get the Quarter Value similar
> 
> > SELECT QUARTER(Created\_DT) FROM TableName;
> 
> > In MySQL it is taking
> 
> > January to March as Quarter 1
> 
> > April to June as Quarter 2
> 
> > July to September as Quarter 3
> 
> > October to December as Quarter 4
> 
> > Is there any method in elasticsearch to find the Quarter Value  
> > similar to MySql?
> 
> > Thanks in Advance!
> 
> > Cheers!
> 
> > George

---

<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, 3:31am UTC](https://discuss.elastic.co/t/quarter-time-range-problem/7379/4 "2017-07-06T03:31:45Z")

</div>


