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 ....) Link to comment https://forums.phpfreaks.com/topic/87200-solved-calculate-the-age/ 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)); ?> Link to comment https://forums.phpfreaks.com/topic/87200-solved-calculate-the-age/#findComment-445990 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! ) Link to comment https://forums.phpfreaks.com/topic/87200-solved-calculate-the-age/#findComment-446004 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 Link to comment https://forums.phpfreaks.com/topic/87200-solved-calculate-the-age/#findComment-446005 Share on other sites More sharing options...
asmith Posted January 22, 2008 Author Share Posted January 22, 2008 glad to see you here again Link to comment https://forums.phpfreaks.com/topic/87200-solved-calculate-the-age/#findComment-446007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.