javascript get seconds between two dates
snippet in javascript

javascript get seconds between two dates

user2882

var secondBetweenTwoDate = Math.abs((new Date().getTime() - oldDate.getTime()) / 1000);

js date difference in seconds

user6098

var t1 = new Date();
var t2 = new Date();
var dif = t1.getTime() - t2.getTime();