// JavaScript program to illustrate
// calculation of no. of days between two date

<script type = “text/javascript” >

// To set two dates to two variables
var date1 = new Date(“06/30/2019”);
var date2 = new Date(“07/30/2019”);

// To calculate the time difference of two dates
var Difference_In_Time = date2.getTime() – date1.getTime();

// To calculate the no. of days between two dates
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);

//To return the final no. of days (result)
RETURN Difference_In_Days;

</script>

Recent Posts

Start typing and press Enter to search