As I am new to javascript so I am asking this question how to find difference between two dates in hours.I am successfully calculated difference but when I give time in format of AM/PM it gives me output as NAN Please check my code I am posting below and thanks in advance:
function calculateTime() {
var d2 = new Date('2018-02-12 03:00:00 AM');
var d1 = new Date('2018-02-10 08:00:00 AM');
var seconds = (d2- d1)/1000;
var hours = seconds/3600;
console.log(hours);
}
calculateTime();