Possible Duplicate:
How do I get the difference between two Dates in JavaScript?
I have a html form which contains 3 fields:
- from_date
- to_date
- no_ofdays
I want to calculate the difference between from_date
and to_date
and the difference will be shown in no_ofdays
field.
My requirement is the to_date
must not be less than from_date
. And if the condition fails
it should not calculate the difference and also the to_date
should remain null
.
I want to do it using JavaScript.