Posted By

kyoji on 02/13/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

liamr
burnandbass


Legal Age Verification


 / Published in: ActionScript 3
 

URL: http://mrdoob.com/blog/post/633

  1. var legalAge : int = 18; // or 21
  2.  
  3. var userDOB : Date = new Date(year,month-1,day);
  4. var today : Date = new Date();
  5.  
  6. var diff : Date = new Date();
  7. diff.setTime( today.getTime() - userDOB.getTime() );
  8.  
  9. var userAge : int = diff.getFullYear() - 1970;
  10.  
  11. if (userAge >= legalAge)
  12. trace("lets get pissed!");
  13. else
  14. trace("go away!");

Report this snippet  

You need to login to post a comment.