# Subtraction between current date and doc created date

**URL:** <https://discuss.elastic.co/t/subtraction-between-current-date-and-doc-created-date/326405>\
**Category:** Kibana\
**Created:** [February 24, 2023, 6:30am UTC](https://discuss.elastic.co/t/subtraction-between-current-date-and-doc-created-date/326405 "2023-02-24T06:30:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [February 24, 2023, 7:00am UTC](https://discuss.elastic.co/t/subtraction-between-current-date-and-doc-created-date/326405/2 "2023-02-24T07:00:18Z")

</div>

Hi @PappuSingh Welcome to the community.

Perhaps this will help it is nearly the same use case.

> [@Calculate elapsed time in Kibana?](https://discuss.elastic.co/t/calculate-elapsed-time-in-kibana/316575/2):
>
> Hi @TXBigDawg1836 Welcome to the community Yup add a runtime field to the Data View here is the code long datenow = new Date().getTime(); long datewas = doc['@timestamp'].value.getMillis(); emit (datenow - datewas); Create / Set the Field Chose your format.... In Discover Now Table...

---

_[View the full topic](https://discuss.elastic.co/t/subtraction-between-current-date-and-doc-created-date/326405)._
