get milliseconds between two dates javascript code example
Example 1: javascript get seconds between two dates
var secondBetweenTwoDate = Math.abs((new Date().getTime() - oldDate.getTime()) / 1000);
Example 2: js date difference in seconds
var t1 = new Date();
var t2 = new Date();
var dif = t1.getTime() - t2.getTime();