asmith Posted January 22, 2008 Share Posted January 22, 2008 hey guys what is the shortest way to calculate a user is for example over 20 years old or not , in my form i get his birthday date . what would be the fastest way ? thanks (the first way i thought about is to manually calculate his birth year , and sub that to the year now , then go to month ....) Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 22, 2008 Share Posted January 22, 2008 I do not know if this is the best way but here is the following in Php <?php $strBirthDate = "1979-07-31"; echo floor((time()-strtotime($strBirthDate))/(86400*365)); ?> Quote Link to comment Share on other sites More sharing options...
asmith Posted January 22, 2008 Author Share Posted January 22, 2008 yea what i needed . thanks rajiv . (btw how are you doing ?? long time no see! ) Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted January 22, 2008 Share Posted January 22, 2008 Your welcome... doing good... been very busy.. so cannot come to the forum too often Quote Link to comment Share on other sites More sharing options...
asmith Posted January 22, 2008 Author Share Posted January 22, 2008 glad to see you here again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.