<div class="codetitle"> <span><a style="CURSOR: pointer" data="54784" class="copybut" id="copybut54784" onclick="doCopy('code54784')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code54784"> <br><script language=javascript> <br> function ages(str) <br> { <br> var r = str.match(/^(d{1,4})(-|/)(d{1,2})2(d{1,2})$/); <br> if(r==null)return false; <br> var d= new Date(r[1], r[3]-1, r[4]); <br> if (d.getFullYear() ==r[1]&&(d.getMonth() 1)==r[3]&&d.getDate()==r[4]) <br> ; ages("1980-03-22")); <br> alert(ages("2002-01-31")); <br> alert(ages("2002-01-41")); <br> < ;/script><br><br> </div>