# Calculate difference of time betwwen two logs formats!

**URL:** <https://discuss.elastic.co/t/calculate-difference-of-time-betwwen-two-logs-formats/144295>\
**Category:** Logstash\
**Created:** [August 14, 2018, 8:26am UTC](https://discuss.elastic.co/t/calculate-difference-of-time-betwwen-two-logs-formats/144295 "2018-08-14T08:26:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![med\_amine](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@med\_amine](https://discuss.elastic.co/u/med_amine)\
**Post date:** [August 14, 2018, 8:26am UTC](https://discuss.elastic.co/t/calculate-difference-of-time-betwwen-two-logs-formats/144295/1 "2018-08-14T08:26:28Z")

</div>

hello guys ,  
i have used ruby filter to calculate difference of time betwwen two logs formats which are ;

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 14, 2018, 12:05pm UTC](https://discuss.elastic.co/t/calculate-difference-of-time-betwwen-two-logs-formats/144295/2 "2018-08-14T12:05:03Z")

</div>

> [@med\_amine](#):
>
> 21/May/2018:08:28:15 +0100

That is not a date format that to\_f can parse. You could use strptime to create a DateTime, then to\_s that, and then use iso8601.to\_f to convert that to a float.

---

<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:** [September 11, 2018, 12:05pm UTC](https://discuss.elastic.co/t/calculate-difference-of-time-betwwen-two-logs-formats/144295/3 "2018-09-11T12:05:08Z")

</div>

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