# Parameters for dates

**URL:** <https://discuss.elastic.co/t/parameters-for-dates/271546>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [April 28, 2021, 6:29pm UTC](https://discuss.elastic.co/t/parameters-for-dates/271546 "2021-04-28T18:29:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pallavibhushan](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@Pallavibhushan](https://discuss.elastic.co/u/Pallavibhushan)\
**Post date:** [April 28, 2021, 6:29pm UTC](https://discuss.elastic.co/t/parameters-for-dates/271546/1 "2021-04-28T18:29:52Z")

</div>

Hi,

Below is my use case  
= % of requests where [actual\_Date] \<= [Planned\_Date]+24 hrs)  
I have written below query  
GET data\_index1/\_search  
{  
"size": 1000,  
"query": {  
"match\_all": {}

},  
"aggs": {  
"NAME": {  
"value\_count": {  
"script": {  
"lang": "painless",  
"source": "doc['actual\_Date'].value.toInstant().toEpochMilli() \<= doc['Planned\_Date'].value.toInstant().toEpochMilli()"  
}  
}  
}  
}  
}

I am not able to figure out how to calculate +24 hours and add it .  
24 hours i need to calculate as below  
"source": "doc['start\_Date'].value.toInstant().toEpochMilli() -doc['end\_Date'].value.toInstant().toEpochMilli()"

Please help me with this  
Thanks in advance

---

<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:** [May 26, 2021, 6:30pm UTC](https://discuss.elastic.co/t/parameters-for-dates/271546/2 "2021-05-26T18:30:08Z")

</div>

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