0

I want to get the time elapsed between two timestamps and then convert the difference to human readble time (HH:mm:ss)

I do it like this (just example of values)

var difference =  1490265243 - 1490264952 ;

while 1490264952 is 23/3/2017 11:29:12 and 1490265243 is 23/3/2017 11:34:03

I get difference equal to 291

then when I convert it to date

var date = new Date(difference*1000);

I get 01:04:51 while the difference is just 00:04:51

I want to get the real time elapsed

how to solve this issue ?

Taha
  • 1,072
  • 2
  • 16
  • 29
  • check your `time value` `var difference = 1490265243 - 1490264952 ;` its not have time value only have a date .time value contains [`13`number](https://www.w3schools.com/jsref/jsref_gettime.asp) .But your code only `10`numbers – prasanth May 08 '17 at 10:40
  • OP is probably using unix timestamps – yezzz May 08 '17 at 10:46

0 Answers0