Calcluate the number of days between dates using javascript

by Alaksandar Jesus Gene

HTML

<input type="text" id="startDate" placeholder="MM/DD/YYYY" value="10/22/2015">
 <input type="text" id="endDate" placeholder="MM/DD/YYYY" value="10/23/2015">
     <button id="calculate">Calculate Days</button>
     
     <h3 id="result">The difference between the dates are <span class="days"></span> day(s)</h3>

CSS

.days{
    
    text-decoration : underline;
}

#result{
    display:none;
    
}

JavaScript

$("#calculate").click(function(){

	millSecondsOutput = new Date($("#endDate").val().toString()) - new Date($("#startDate").val().toString())
    
    convertMilliSecondstoSeconds= millSecondsOutput/1000;
    convertSecondstoHours = convertMilliSecondstoSeconds/(60*60);
    convertHourstoDays = convertSecondstoHours/24;
    $(".days").text(convertHourstoDays);
    $("#result").show();
})