# Calculate days between two dates in jquery

Today, We want to share with you Calculate days between two dates in jquery.In this post we will show you wordpress plugin require another plugin, hear for how to get number of days between two dates using jquery we will give you demo and example for implement.In this post, we will learn about calculate number of days between 2 dates jquery with an example.

## Calculate days between two dates in jquery

There are the Following The simple About JQuery Number of days between two inputted dates Full Information With Example and source code.

As I will cover this Post with live Working example to develop count Number of Days Between Two Dates in Jquery, so the How to get the number of days between two Dates in JavaScript? is used for this example is following below.

### How to get the number of days between two Dates in jquery?

```<!DOCTYPE html>
<html>
<title>simple Jquery get difference between two dates in days example - source code with demo</title>
<body>

<script type="text/javascript">
var total_days = totaldaysdifference('10/11/2020', '10/20/2020');

console.log(total_days);

function totaldaysdifference(firstDate, secondDate){
var sourceDay = new Date(firstDate);
var lastDay = new Date(secondDate);

var diff_between = sourceDay.getTime() - lastDay.getTime();
var total_days = diff_between / (1000 * 3600 * 24);

return Math.round(Math.abs(total_days));
}
</script>

</body>
</html>
```

Free Live Chat for Any Issue

How to calculate the number of days between two dates in javascript?

```<script type = "text/javascript" >

var sourceDay = 1000 * 60 * 60 * 24
var current_date = new Date();
var trips_day = new Date(current_date.getFullYear(), 11, 25)

if (current_date.getMonth() == 11 && current_date.getdate() > 25)
trips_day.setFullYear(trips_day.getFullYear() + 1)

var Result = Math.round(trips_day.getTime() - current_date.getTime()) / (sourceDay);

var output = Result.toFixed(0);

document.write("Total Number of days remaining till Trips Date.<br>"
+ current_date + "<br> and <br>"
+ trips_day + " is: <br> "
+ output);
</script>
```

Count total days between two dates in jquery

```<script type = "text/javascript" >

var sourceDay = new Date("06/30/2022");
var lastDay = new Date("07/30/2022");

var diff_between = lastDay.getTime() - sourceDay.getTime();

var diff_between = diff_between / (1000 * 3600 * 24);

document.write("Total number of days between dates <br>"
+ sourceDay + "<br> and <br>"
+ lastDay + " is: <br> "
+ diff_between);

</script>
```