
display date format as dd/mm/yyyy and day could take only between 01-31 & month could take only between 01-12 & year could take only between 1990-2090. i use this script, bt i could n't. please help me. thank u
var date=/^\d{2}\/\d{2}\/\d{4}$/ if(document.userform.joindate.value.search(date)==-1) { alert("please enter date format as dd/mm/yyyy"); document.userform.joindate.focus(); return false; }

<html>
<head>
<script language="JavaScript">
function checkdate(date1,date2){
var validformat=/^\d{4}\-\d{2}\-\d{2}$/
var returnval=false
if(!validformat.test(date1.value)){
alert("Invalid Date 1");
document.form.date1.value="";
}
else if(!validformat.test(date2.value)){
alert("Invalid Date 2");
document.form.date2.value="";
}
else{
var start = document.form.date1.value;
var end = document.form.date2.value;
var stDate = new Date(start);
var enDate = new Date(end);
var compDate = enDate - stDate;
if(compDate >= 0)
return true;
else
{
alert("End date should be greater than start date.");
return false;
}
}
}
</script>
</head>
<form name="form">
<table>
<tr><td>Enter Start Date:</td><td><input type="text" name="date1" ></td></tr>
<tr><td>Enter End Date:</td><td><input type=text name="date2" ></td></tr>
<tr><td><input type="button" onClick="checkdate(this.form.date1, this.form.date2);" value="Check Date"></td></tr>
</table>
</form>
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.