I have two textboxes i used calender control extender. I want to compare two dates and display no of days. using javascript how to compare in javascript i want how can i write.
please help
thanq.
Javascript date compare
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Sep 26, 2011, 10:03 PM EDT
Here you can get some idea about this.
Comaprission of dates for a year in JavaScript
Kiranpreet ChawlaRank #2,813 · 504 reputationPosted Sep 26, 2011, 10:19 PM EDT
runat="server"
TargetControlID="TextBox1"
PopupButtonID="btnCalenderPopup"
OnClientDateSelectionChanged="checkDate"
Format="dd/MM/yyyy" />
As shown, implement the OnClientDateSelectionChanged event, and call "checkDate" function. Define this function in javascript as shown:
And then,To find the number of days between any two dates , use following javascript:
var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds
var firstDate = new Date(2008,01,12);
var secondDate = new Date(2008,01,22);
var diffDays = Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay));
This will give you number of days between two dates.
Thanks.
If this helped you. Please mark it as an ANSWER.