I have used the below code but i am confused with the result,
like, difference between dates
(10 Sep 2016) and (30 Sep 2016) == 20 days.
(10 Sep 2016) and (01 Oct 2016) == 22 days.
It should be 21 days.
Code
<script type="text/javascript">
var days = 1000 * 60 * 60 * 24;
var firstDate = new Date(2016, 9, 10);
var secondDate = new Date(2016, 10, 1);
var timeDiff = Math.abs(secondDate.getTime() - firstDate.getTime());
var diffDays = Math.floor(timeDiff / (1000 * 3600 * 24));
alert(diffDays);
</script>
can any one help me on this or please share me the better solution.
Thank You