# Kibana - Calculate range of time like hours

**URL:** https://discuss.elastic.co/t/kibana-calculate-range-of-time-like-hours/290986
**Category:** Kibana
**Created:** [December 5, 2021, 1:44pm UTC](https://discuss.elastic.co/t/kibana-calculate-range-of-time-like-hours/290986 "2021-12-05T13:44:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![redsegsolucoes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redsegsolucoes/32/98294_2.png) [@redsegsolucoes](https://discuss.elastic.co/u/redsegsolucoes)
#### Post date: [December 5, 2021, 1:44pm UTC](https://discuss.elastic.co/t/kibana-calculate-range-of-time-like-hours/290986/1 "2021-12-05T13:44:07Z")

</div>

I would like to know how to calculate dates inside Kibana, for example, (end\_date - start\_date),  
How long does it take for a driver to get from city A to city B?  
is possible to do this calculation inside Query DSL and extract hours to compare hours.

---

<div class="post-metadata">

### Author: ![Felix\_Roessel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_roessel/32/41623_2.png) [@Felix\_Roessel](https://discuss.elastic.co/u/Felix_Roessel)
#### Post date: [December 7, 2021, 9:25pm UTC](https://discuss.elastic.co/t/kibana-calculate-range-of-time-like-hours/290986/2 "2021-12-07T21:25:47Z")

</div>

You can have a look into runtime fields. That helps to calculate the time diff between two date fields within the same document.

---

<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: [January 4, 2022, 9:26pm UTC](https://discuss.elastic.co/t/kibana-calculate-range-of-time-like-hours/290986/3 "2022-01-04T21:26:30Z")

</div>

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