I need to check the data format in dd-mm-yyyy
format.
I'm using the following:
if (ValidateDate() == false) {
alert("Wrong Date Format");
return false;
}
function ValidateDate() {
var dtValue = $('#txtEnteredStartDate').val();
var dtRegex = new RegExp("^(([1-9]|0[1-9]|1[0-9]|2[1-9]|3[0-1])[-]([JAN|FEB|MAR|APR|MAY|JUN|JULY|AUG|SEP|OCT|NOV|DEC])[-](d{4}))$");
return dtRegex.test(dtValue);
}
But when I enter dd-mmm-yyyy
in the field, for example 19-Nov-2015
, I'm getting the error Wrong date format
What am I doing wrong?