calculate datetime javascript code example
Example 1: subtracting two date objects in javacript
function findDayDifference(date1, date2) {
// always round down
return Math.floor((Math.abs(date2-date1))/(1000*60*60*24));
}
Example 2: javascript calculate time
console.time("timer"); //start time with name = timer
console.timeEnd("timer"); //end timer and log time difference