# How would I calculate the difference between 2 epoch timestamps

**URL:** https://discuss.elastic.co/t/how-would-i-calculate-the-difference-between-2-epoch-timestamps/93035
**Category:** Elasticsearch
**Created:** [July 13, 2017, 2:34pm UTC](https://discuss.elastic.co/t/how-would-i-calculate-the-difference-between-2-epoch-timestamps/93035 "2017-07-13T14:34:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tickticktick](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tickticktick](https://discuss.elastic.co/u/tickticktick)
#### Post date: [July 13, 2017, 2:34pm UTC](https://discuss.elastic.co/t/how-would-i-calculate-the-difference-between-2-epoch-timestamps/93035/1 "2017-07-13T14:34:29Z")

</div>

I have max and min timestamp. Wanted to calculate the difference between 2 epoch...

example...  
min\_timestamp - 1499692908165  
max\_timestamp - 1499698428128

diff. that i have got is - 5519963, which is the actual difference b/w 2 numbers... How would ES calculate the actual time spent between1499698428128 and 1499692908165?

expecting the output to be in the format: '1d 12h 18m 30s'

---

<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 10, 2017, 2:35pm UTC](https://discuss.elastic.co/t/how-would-i-calculate-the-difference-between-2-epoch-timestamps/93035/2 "2017-08-10T14:35:04Z")

</div>

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