Possible Duplicate:
How do I get the difference between two Dates in JavaScript?
How to get the difference between two dates using javascript.I need the exact day difference between those two dates.Here is my code
function calculateDifference() {
var startDate = document.getElementById("MainContent_txtOStartDate").value;
var endDate = document.getElementById("MainContent_txtOEndDate").value;
return DateDiff(startDate, endDate);
}
function DateDiff(startDate, endDate) {
var a = Date.parse(startDate) - Date.parse(endDate);
alert(a);
}
Any suggestion?