# Help with Elapsed Time

**URL:** <https://discourse.nodered.org/t/help-with-elapsed-time/17855>\
**Category:** General\
**Created:** [12 November 2019 19:06 UTC](https://discourse.nodered.org/t/help-with-elapsed-time/17855 "2019-11-12T19:06:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ki-va](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ki-va/32/22283_2.png) [@Ki-va](https://discourse.nodered.org/u/Ki-va)\
**Post date:** [12 November 2019 19:06 UTC](https://discourse.nodered.org/t/help-with-elapsed-time/17855/1 "2019-11-12T19:06:08Z")

</div>

Hi,  
I'm running a Node-red on RPI3 and need help with Elapsed Time:  
I'm trying accomplish two things:  
1.Get an input from the user about the date and time then calculate an elapsed time from that point forward. I want to save the users input so in case of a blackout the count will continue from the users input point.  
The output of the count should include days, hours, minutes and seconds of the elapsed time and also a reset button for the users input data in order to put new date and time.  
2.I have a photosensitive module connected to the RPI and I want count elapsed time when there is light and again when it is dark with the same format: days, hours, minutes and seconds stating how long there were light an how long darkness.

Thanks in advance  
Kiva.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 November 2019 19:35 UTC](https://discourse.nodered.org/t/help-with-elapsed-time/17855/2 "2019-11-12T19:35:34Z")

</div>

Would it help to know that a date/time value in JavaScript is a number of milliseconds from a fixed point in the past?

So you can simply subtract a starting value from _now_ to get an elapsed number of milliseconds that you can then convert as you like.
