Examples are as follows:
function isDate(dateString){ if(dateString.trim()=="")return true; var r=dateString.match(/^(/d{1,4})(-|//)(/d{1,2})/2(/d{1,2})$/); if(r==null){ alert("Please enter the correct format date/n/r date format: yyyy-mm-dd/n/rFor example: 2008-08-08/n/r"); return false; } var d=new Date(r[1],r[3]-1,r[4]); var num = (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]); if(num==0){ alert("Please enter the correct formatted date/n/r date format: yyyy-mm-dd/n/r For example: 2008-08-08/n/r"); } return (num!=0); }The simple way to determine whether the entered string is in the date format in the above article is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.