I have a bit of Javascript that is checking to see that a date is enter in this format
DD/MM/YYYY
sDate is the input field
Code:
if(isNaN(sDate.substring(0, 2)) || isNaN(sDate.substring(3, 5)) || isNaN(sDate.substring(6, 10)) || sDate.charAt(2) != "/" || sDate.charAt(5) != "/") {
alert("Date needs to be in format DD/MM/YYYY.");
return false;
}
Problem is I have been told that it must accept say 1/9/2004 which the above doesn't accept.
Im rubbish at Regular Expressions, is there a regular expression that can do this check?
TIA Dale