I have written a function using javascript for validating a Date selected from a calendar to a text box, with the current date. And I not getting a correct result. The date format displayed in text box is “01-Oct-2010”. And the function i had created is as follows :
function CheckDate() {
var today = new Date();
var startDate = document.getElementById("<%=txtStartDate.ClientID %>").value;
var endDate = document.getElementById("<%=txtEndDate.ClientID %>").value;
if (Date.parse(endDate) >= today) {
alert("End Date should not be greater than Today");
}
return true;
}
you can use the above javascript code.
Note: Make getMonthInDigit function which return value in digit as required.