# Calculating elapsed time

**URL:** <https://forums.losant.com/t/calculating-elapsed-time/3201>\
**Category:** Help\
**Tags:** workflow\
**Created:** [August 18, 2020, 2:57pm UTC](https://forums.losant.com/t/calculating-elapsed-time/3201 "2020-08-18T14:57:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [August 18, 2020, 2:57pm UTC](https://forums.losant.com/t/calculating-elapsed-time/3201/1 "2020-08-18T14:57:34Z")

</div>

I’m grabbing 2 different “time” variables from 2 different virtual buttons when triggered and adding them to the payload and as a workflow storage value  
In the debug window, time shows as “Tue Aug 18, 2020 10:48:26.738 GMT-04:00”  
Which node and format helper is best to use to calculate the time difference between these 2 values?

I tried using the DATE/TIME node, but I get “invalid date: undefined” message in debug.

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [August 18, 2020, 4:14pm UTC](https://forums.losant.com/t/calculating-elapsed-time/3201/3 "2020-08-18T16:14:14Z")

</div>

Hi @Lars_Andersson,

Would you be able to include a screenshot of your configuration for this node? The Date/Time Node is the approach I would have recommended, and so I would like to look a bit further into the error you are seeing.

You also have the option of [using the {{formatDateRelative}} Helper](https://docs.losant.com/workflows/accessing-payload-data/#format-helpers), but this will format your value as a relative string: “`about six minutes ago`.”

Thanks!  
Julia

---

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [August 18, 2020, 8:07pm UTC](https://forums.losant.com/t/calculating-elapsed-time/3201/5 "2020-08-18T20:07:44Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/5/5c1c98bac73ddd0db8fdf40f0ac09ee8a6217437.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/3/37395d6635b7dd97fe7dda833ba79cf71fa75937.png)

---

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [August 19, 2020, 12:22pm UTC](https://forums.losant.com/t/calculating-elapsed-time/3201/7 "2020-08-19T12:22:32Z")

</div>

I had a combination of mistakes.

1. I needed to format the time to unix time.
2. Both time values wasn’t available at the time for diff calc.

I’m good now.
