# Calculate Date Difference using jquery Example

Today, We want to share with you Calculate Date Difference using jquery.In this post we will show you jquery difference between two dates in months, hear for javascript difference between two dates in years months days we will give you demo and example for implement.In this post, we will learn about How to calculate the number of days between two dates in javascript? with an example.

## Calculate Date Difference using jquery demo

Contents

There are the Following The simple About Calculate Date Difference using javascript Full Information With Example and source code.

As I will cover this Post with live Working example to develop calculate no of days between two dates in jquery datepicker, so the check date between two dates in jquery for this example is following below.

### Example 1: How to calculate the number of days between two dates in javascript?

index.html

```
var startDay = new Date("06/30/2020");
var endDay = new Date("07/30/2020");

var Difference_In_Time = endDay.getTime() - startDay.getTime();
var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);

document.write("Total number of days between star dates & End Dates <br>"
+ startDay + "<br> and <br>"
+ endDay + " is: <br> "
+ Difference_In_Days);

```

### Example 2: Jquery get difference between two dates in days example

index.html

```

Jquery get difference between two dates in days example

var Difference_In_Days = daysdifference('10/11/2020', '10/20/2020');

console.log(Difference_In_Days);

function daysdifference(firstDate, secondDate){
var startDay = new Date(firstDate);
var endDay = new Date(secondDate);

var millisBetween = startDay.getTime() - endDay.getTime();
var Difference_In_Days = millisBetween / (1000 * 3600 * 24);

return Math.round(Math.abs(Difference_In_Days));
}

```