Published in: JavaScript
//Function return age. function getAge(Y,M,D){ var now=new Date(),m=now.getMonth()+1,d=now.getDate(); return now.getFullYear()-Y+(M>m?-1:M==m&&D>d?-1:0); }
You need to login to post a comment.
Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.
nicolaspar on 04/18/08
javascript data AGE calculate birthdate
1 person has marked this snippet as a favorite
Published in: JavaScript
//Function return age. function getAge(Y,M,D){ var now=new Date(),m=now.getMonth()+1,d=now.getDate(); return now.getFullYear()-Y+(M>m?-1:M==m&&D>d?-1:0); }
You need to login to post a comment.