i want to find find differences between two dates, where m giving date value in the text box and i want the differences/duration to some other textbox.
<script language=javascript>
function formshowhide(id) {
if (id == "other") {
//document.getElementById('quotef').style.display = "block";
document.getElementById('otherf').style.display = "block";
//here m writng the function for finding duration
var txtdate1 = document.getElementById('MainContent_txtOStartDate').value;
var txtdate2 = document.getElementById('MainContent_txtOEndDate').value;
var date1 = new Date(txtdate1.split('-')[0], txtdate1.split('-')[1] - 1, txtdate1.split('-')[2]);
var date2 = new Date(txtdate2.split('-')[0], txtdate2.split('-')[1] - 1, txtdate2.split('-')[2]);
var timediffsec = date2.getTime() - date1.getTime();
var timediffday = parseInt(timediffsec / (24 * 3600 * 1000));
document.getElementById('MainContent_txtDays').value = timediffday;
//here the function end for finding the duration
}
else {
// document.getElementById('quotef').style.display = "none";
document.getElementById('otherf').style.display = "none";
}
}
</script>
Then you can display whatever you want from the timespan: