Answers for "js get time between two dates"

2

javascript get seconds between two dates

var secondBetweenTwoDate = Math.abs((new Date().getTime() - oldDate.getTime()) / 1000);
Posted by: Guest on January-30-2020
0

get the difference between two dates js

const date1 = new Date('7/13/2010');
const date2 = new Date('12/15/2010');
const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); 
console.log(diffTime + " milliseconds");
console.log(diffDays + " days");
Posted by: Guest on November-13-2020

Code answers related to "js get time between two dates"

Code answers related to "Javascript"

Browse Popular Code Answers by Language