Hi This script solve your date campare problem with javascript function that apply with custom validation controls........so use easily ...You can make easily date formate in dd/mm/yyyy.
function CompareDates() { var str1 = document.getElementById("ctl00_ContentPlaceHolder1_txtto").value; var str2 = document.getElementById("ctl00_ContentPlaceHolder1_txtfrom").value; var dt1 = parseInt(str1.substring(0,2),10); var mon1 = parseInt(str1.substring(3,5),10); var yr1 = parseInt(str1.substring(6,10),10); var dt2 = parseInt(str2.substring(0,2),10); var mon2 = parseInt(str2.substring(3,5),10); var yr2 = parseInt(str2.substring(6,10),10); var date1 = new Date(yr1, mon1, dt1); var date2 = new Date(yr2, mon2, dt2); if(date2 <= date1) { //alert("You are Correct"); return false; } else { alert("Required Date Must Be Greater Than System Date"); document.form1.Submit(); } }
thanks & best regards, kamlesh sancheti
|
No responses found. Be the first to respond and make money from revenue sharing program.
|