# Hide weekends for date histogram field in time series in graph

**URL:** <https://discuss.elastic.co/t/hide-weekends-for-date-histogram-field-in-time-series-in-graph/305434>\
**Category:** Kibana\
**Created:** [May 23, 2022, 8:14pm UTC](https://discuss.elastic.co/t/hide-weekends-for-date-histogram-field-in-time-series-in-graph/305434 "2022-05-23T20:14:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ghudgins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghudgins/32/138532_2.png) [@ghudgins](https://discuss.elastic.co/u/ghudgins)\
**Post date:** [May 23, 2022, 9:23pm UTC](https://discuss.elastic.co/t/hide-weekends-for-date-histogram-field-in-time-series-in-graph/305434/2 "2022-05-23T21:23:52Z")

</div>

this is a workaround at best but could be an interesting option to try. Longer term answer below

Use a runtime field to emit the date as a string at the right granularity with the weekend logic. Use "Top Values" and rank by alphabetical

```auto

ZonedDateTime input = doc['@timestamp'].value;

String output = input.format(DateTimeFormatter.ofPattern('yyyy-mm-dd'));

emit(output);

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/8/7828cc108ca3a9e96e4f8497f9e636d14a76ad43.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/8/78423515f9c8e098da5ed070aa852f782c58df3c.jpeg)

I have groomed the existing request for this and added a quote / screenshot from this discussion for the longer term fix. [[Lens] Time series only for weekdays · Issue #2942 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/2942) - I agree we should have native support for this in the date histogram.

---

_[View the full topic](https://discuss.elastic.co/t/hide-weekends-for-date-histogram-field-in-time-series-in-graph/305434)._
