I have a date format like: YYYY-MM-DD, as we all know that the months only contains numbers like 01,02,03,04,05,06,07,08,09,10,11,12. How can I actually write a regular expression that allows me to only get the correct months as well as dates. I could only do something like this...
var date = /[0-9]{4}\-[0-9]{2}\-[0-9]{2}/;
function checkDate(Date)
{
if (date.test(Date))
{
alert("Valid Date");
}
else
{
alert("Invalid Date");
}
}
Thus, if the date is for example, 2008-24-43. It will still return me valid date.
Thanks.