# I want to get a status based on the date difference ersult

**URL:** <https://discuss.elastic.co/t/i-want-to-get-a-status-based-on-the-date-difference-ersult/333054>\
**Category:** Kibana\
**Created:** [May 10, 2023, 8:35am UTC](https://discuss.elastic.co/t/i-want-to-get-a-status-based-on-the-date-difference-ersult/333054 "2023-05-10T08:35:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alig](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@alig](https://discuss.elastic.co/u/alig)\
**Post date:** [May 10, 2023, 8:35am UTC](https://discuss.elastic.co/t/i-want-to-get-a-status-based-on-the-date-difference-ersult/333054/1 "2023-05-10T08:35:00Z")

</div>

Hi there,  
This is what I am using in scripted fields

def sorDate = new Date().getTime() - doc['sor\_idate'].value;  
if (sorDate \> 5){  
return "crtical"  
};  
The field is defined as below and I have an error and cannot figure out what is wrong, would deeply appreciate the help. Thanks

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/4/840b22657ff7ccd9db1fe5aefeda87cbb1e0c3d9.png)

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [May 11, 2023, 11:41am UTC](https://discuss.elastic.co/t/i-want-to-get-a-status-based-on-the-date-difference-ersult/333054/2 "2023-05-11T11:41:32Z")

</div>

Hi @alig,

Welcome to the community! I see a warning message in the corner of the image, but no error detail. Can you share the error detail you are seeing?

---

<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:** [June 8, 2023, 11:42am UTC](https://discuss.elastic.co/t/i-want-to-get-a-status-based-on-the-date-difference-ersult/333054/3 "2023-06-08T11:42:22Z")

</div>

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