Cubbybulin
asked on
asp.net javascript datediff of 2 textbox dates
I have 2 textboxes that I want to enter dates into and a third textbox I want to automatically enter the number of days (datediff +1) difference of the 2 dates. I need to NOT have a postback for this and want to accomplish it in javascript. Would need it to evaluate if the text in the textboxes are actual dates (isdate()) and perform the calculation when leaving either textbox and fill in the third textbox with the number. Any help would be greatly appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<script type="text/javascript" src="date.js"></script>
<script type="text/javascript">
var minutes = 1000*60;
var hours = minutes*60;
var days = hours*24;
var foo_date1 = getDateFromFormat("02/10/2
var foo_date2 = getDateFromFormat("02/12/2
var diff_date = Math.round((foo_date2 - foo_date1)/days);
alert("Diff date is: " + diff_date ); </script>