date calculator between two dates

Welcome Back to shortlearner.com, In our previous post we learn find days between two dates using php.
today we will see how to find total number of days between two days using javascript.
days between dates

<script>
      
var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds

var firstDate = new Date(2019,01,26);
var secondDate = new Date(2020,01,26);
var firstDate = new Date(from);
var secondDate = new Date(to);
var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay)));

alert(diffDays);
</script>