How to find Date difference between two dates in jQuery
In this article, I will share with you how to find Date difference between two dates in jQuery
#1: Example
var date1 = new Date("06/30/2019");
var date2 = new Date("07/30/2019");
var Difference_In_Time = date2.getTime() - date1.getTime();
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);
console.log("Total number of days between dates "+ date1 + " and " + date2 + " is: " + Difference_In_Days);
#Output:
Total number of days between dates Sun Jun 30 2019 00:00:00 GMT+0530 (India Standard Time) and Tue Jul 30 2019 00:00:00 GMT+0530 (India Standard Time) is: 30
You can run and check it.
I hope it will help you.
Copyright 2024 ErrorGram