I'm doing a PHP project which needs to take data from the user which includes date. The datepicker method using jQuery seems not working. So, i decided to get the correct date using javascript.
So far, i am able to check the correct format using following script.
function checkdate(input)
{
var dateformat=/^\d{2}\/\d{2}\/\d{4}$/ //Check for format validity
if (!dateformat.test(input.value))
{
document.getElementById("error").innerHTML="Invalid Date format, use MM/DD/YYYY";
return false;
}
else
{
document.getElementById("error").innerHTML="";
return true;
}
I want to validate those ranges month(1-12)/Day(1-31)/year(2000-2014).
I'm looking for any other possible alternate way to get the correct date from user too.