How to validate date in yyyy-mm-dd format using javascript. so far i have come up with this code.
<script>
function checkdate(form)
{
var a = document.forms["form"]["stdt"].value;
Check = /^([0-9]{2})-([0-9]{2})-([0-9]{4})$/;
if(!a.match(Check)) {
alert("Error: Date format: ##-##-#### ");
return false;
}
}
</script>
and HTML code
<form id="myform" onsubmit="return checkdate(this);" method="post" action="">
The above will return true for 11-55-1999
(1[012]|0[1-9])will match the numbers 01..12.