Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js get difference in days

const date1 = new Date('19/1/2021');
const date2 = new Date('20/1/2021');
const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); 
console.log(diffTime + " milliseconds");
console.log(diffDays + " days");
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #difference #days
ADD COMMENT
Topic
Name
3+5 =