Get The Time Difference Between Two Times In Format Hh:mm:ss
I have two times in HH:mm:ss format. I am trying to calculate the time difference between two times. like var timeStart = '01:00:24'; var timeEnd = '01:00:34' var timeDiff =
Solution 1:
You can split them with :
and take difference. And again join them with :
var start = '01:00:24';
var end = '01:00:34';
var diff = start.split(':').map((item,index) => end.split(':')[index] - item).join(':')
console.log(diff)
Post a Comment for "Get The Time Difference Between Two Times In Format Hh:mm:ss"