Posted By

nicolaspar on 04/18/08


Tagged

javascript data AGE calculate birthdate


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

blackabee


getAge


 / Published in: JavaScript
 

  1. //Function return age.
  2. function getAge(Y,M,D){
  3. var now=new Date(),m=now.getMonth()+1,d=now.getDate();
  4. return now.getFullYear()-Y+(M>m?-1:M==m&&D>d?-1:0);
  5. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Xek on July 19, 2008

Great...

You need to login to post a comment.