function calculate(sender, args) {
var value1 = document.getElementById('<%=txtSDate.ClientID%>').value.split("/");
var value2 = document.getElementById('<%=txtEDate.ClientID%>').value.split("/");
var dttime = new Date(value1[2], value1[1] - 1, value1[0]) //Month is 0-11 in JavaScript
today = new Date(value2[2], value2[1] - 1, value2[0])
date1 = new Date(today)
date1.setHours(0, 0, 0, 0);
if (dttime > date1) {
document.getElementById('<%=txtEDate.ClientID%>').value = "";
alert("From date is greater than to date! ");
}
else {
//Get 1 day in milliseconds
var oneday = 1000 * 60 * 60 * 24
//Calculate diff between the two dates, and convert to days
document.getElementById('<%=txtNoofDays.ClientID%>').value = (today.getTime() - dttime.getTime()) / (oneday);
}
}
it will Calculates diff between the two dates, and convert to days
it will Calculates diff between the two dates, and convert to days