# Time difference between a field and current time

**URL:** <https://discuss.elastic.co/t/time-difference-between-a-field-and-current-time/339494>\
**Category:** Kibana\
**Tags:** painless, dashboard, data-views, runtime\
**Created:** [July 28, 2023, 5:19am UTC](https://discuss.elastic.co/t/time-difference-between-a-field-and-current-time/339494 "2023-07-28T05:19:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathur7vidit](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mathur7vidit](https://discuss.elastic.co/u/mathur7vidit)\
**Post date:** [July 28, 2023, 5:19am UTC](https://discuss.elastic.co/t/time-difference-between-a-field-and-current-time/339494/1 "2023-07-28T05:19:51Z")

</div>

Hi Team,

we have a field namely last\_modified\_date and we want to calculate aging time by noting the time difference between current time and last\_modified\_date. how can i achieve it via runtime field.

---

<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:** [July 28, 2023, 5:55am UTC](https://discuss.elastic.co/t/time-difference-between-a-field-and-current-time/339494/2 "2023-07-28T05:55:43Z")

</div>

Perhaps take a look at [this](https://discuss.elastic.co/t/calculate-elapsed-time-in-kibana/316575/2) post

---

<div class="post-metadata">

**Author:** ![mathur7vidit](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mathur7vidit](https://discuss.elastic.co/u/mathur7vidit)\
**Post date:** [July 28, 2023, 8:37am UTC](https://discuss.elastic.co/t/time-difference-between-a-field-and-current-time/339494/3 "2023-07-28T08:37:49Z")

</div>

Thanks @stephenb for quick response. that discussion helped!  
basically i didnt even have to define now and substract it. i can simply use relative date format and it worked.

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

---

<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:** [August 25, 2023, 8:37am UTC](https://discuss.elastic.co/t/time-difference-between-a-field-and-current-time/339494/4 "2023-08-25T08:37:55Z")

</div>

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