Answers for "compare two dates and get number of days between two dates javascript"

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 "compare two dates and get number of days between two dates javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language