I have Used two date using datepicker .how to calculate date difference in jquery.
I have applied blow code but in that, the code I want 3 days to count using the form to date that time count will be 2 displayed.
- @Html.TextBoxFor(m => m.fromDate, new { @class = "form-control", @placeholder = "From Date", @id = "fromDate"})
- @Html.TextBoxFor(m => m.toDate, new { @class = "form-control", @placeholder = "To Date", @id = "toDate"})
-
-
-
- $("#fromDate").datepicker({
-
- minDate: 0,
- maxDate: '+0Y+1M',
-
- onSelect: function (dateStr) {
- var min = $(this).val();
- }
- });
-
- $("#toDate").datepicker({
-
- minDate: '0',
- maxDate: '+0Y+1M',
- onSelect: function (dateStr) {
- debugger;
- var max = $(this).val();
-
- var start = $("#fromDate").val();
- var end = $("#toDate").val();
-
- var days = Math.round(Math.abs((new Date(end) - new Date(start)) / (1000 * 60 * 60 * 24)));
- $("#TextBox3").val(Math.round(days));
- }
- });
please help
I want data that like..
01/07/2019 TO 03/07/2019 Totals days =3