# Viewing the documents on per weekday classification?

**URL:** <https://discuss.elastic.co/t/viewing-the-documents-on-per-weekday-classification/73093>\
**Category:** Elasticsearch\
**Created:** [January 28, 2017, 5:32pm UTC](https://discuss.elastic.co/t/viewing-the-documents-on-per-weekday-classification/73093 "2017-01-28T17:32:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaswanth](https://avatars.discourse-cdn.com/v4/letter/y/94ad74/32.png) [@Yaswanth](https://discuss.elastic.co/u/Yaswanth)\
**Post date:** [January 28, 2017, 5:32pm UTC](https://discuss.elastic.co/t/viewing-the-documents-on-per-weekday-classification/73093/1 "2017-01-28T17:32:54Z")

</div>

Hi,

i have data like this  
{"text": "are","created\_at": "2017-01-29T05:30:36.000Z"} --sunday  
{"text": "hi","created\_at": "2017-01-28T18:30:36.000Z"}--saturday  
{"text": "you","created\_at": "2017-01-31T09:30:36.000Z"} --tuesday  
{"text": "how","created\_at": "2017-01-28T11:30:36.000Z"}--sunday  
{"text": "hello","created\_at": "2017-01-30T23:30:36.000Z"}--monday

For viewing documents on per weekday classification i used the below groovy script:  
`Date date = new Date(doc[date_field].value); date.format(format);`

But in my output i am different days :

```
 "aggregations": {
    "byDays": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "Sunday",
          "doc_count": 2
        },
        {
          "key": "Tuesday",
          "doc_count": 2
        },
        {
          "key": "Saturday",
          "doc_count": 1
        }
      ]
    }
  }
}

```

Do i need to change the timezone to get the accurate days?

---

<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:** [February 25, 2017, 5:33pm UTC](https://discuss.elastic.co/t/viewing-the-documents-on-per-weekday-classification/73093/2 "2017-02-25T17:33:00Z")

</div>

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