[email protected] Posted October 3, 2007 Share Posted October 3, 2007 hello all i need to determine someones age from there DoB i am currently using this bit of code but it keeps giving the wrong answer //Works out the Age of Person $idyear = $iddate[0].$iddate[1]; $idmonth = $iddate[2].$iddate[3]; $idday = $iddate[4].$iddate[5]; $d1=mktime(0,0,0,$idday,$idmonth,$idyear); $d2=mktime(0,0,0,date("d"),date("m"),date("y")); echo "Your age is ".floor(($d2-$d1)/31536000) . "<br>"; Please help Link to comment https://forums.phpfreaks.com/topic/71665-solved-determining-someones-age-with-php/ Share on other sites More sharing options...
[email protected] Posted October 4, 2007 Author Share Posted October 4, 2007 ok i figure it out i was putting the day in the wrong position in mktime() function it is first the month then the day.!! go figure thanks anyway Link to comment https://forums.phpfreaks.com/topic/71665-solved-determining-someones-age-with-php/#findComment-361640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.