count days by timestamp js code example
Example 1: javascript calculate time
console.time("timer"); //start time with name = timer
console.timeEnd("timer"); //end timer and log time difference
Example 2: how to calculate the number of days between two dates in javascript
function javascript (date1, date2) {
let oned = 24 * 60 * 60 * 1000;
return Math.ceil((date2 - date1) / oned);
}
function javascript(date1, date2) {
return new Date(date2 - date1).getDate() - 1
}
function javascript(date1, date2) {
return Math.ceil((date2 - date1) / 8.64e7);
}