# Want to extract data for last 15 days only for business hour by skipping other than business hours

**URL:** <https://discuss.elastic.co/t/want-to-extract-data-for-last-15-days-only-for-business-hour-by-skipping-other-than-business-hours/353972>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [February 23, 2024, 10:32am UTC](https://discuss.elastic.co/t/want-to-extract-data-for-last-15-days-only-for-business-hour-by-skipping-other-than-business-hours/353972 "2024-02-23T10:32:51Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 1, 2024, 10:05am UTC](https://discuss.elastic.co/t/want-to-extract-data-for-last-15-days-only-for-business-hour-by-skipping-other-than-business-hours/353972/4 "2024-03-01T10:05:45Z")

</div>

@2328943_dc take a look at this...

> [@Extracting time from @timestamp field using Runtime](https://discuss.elastic.co/t/extracting-time-from-timestamp-field-using-runtime/348468/4):
>
> So you need to look at examples here... And the API Here... [java.time](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-api-reference-shared-java-time.html)[java.time.chrono](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-api-reference-shared-java-time-chrono.html)[java.time.format](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-api-reference-shared-java-time-format.html)[java.time.temporal](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-api-reference-shared-java-time-temporal.html)[java.time.zone](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-api-reference-shared-java-time-zone.html) OK we can do that as a keyword... filtering and sorting you will need to see if that works... You will need to figure out the timezone stuff if you want to... ZonedDateTime zdt = doc['@timestamp'].value; String datetime = zdt.format(DateTimeFormatter.ISO\_LOCAL\_TIME); emit(datetime);

I think it will help

---

_[View the full topic](https://discuss.elastic.co/t/want-to-extract-data-for-last-15-days-only-for-business-hour-by-skipping-other-than-business-hours/353972)._
