I need to compare two different lines of time (formed: YYYY-MM-DD'T'XN: mm ).
Here are the datetime lines:
var a = ("2017-05-02T10:45");
var b = ("2017-05-02T12:15");
I cut dates from them, so I only need time (formed: HH: mm ).
var now = a.slice(11, 16);
var then = b.slice(11, 16);
Is there any way to get the difference between these two times?
The result should look like this:
1 hour 30 minutes
Also, if the dates are different, is there any simple solution to get the difference in dates?
source
share