jp555soul Posted December 10, 2010 Share Posted December 10, 2010 So Im in the weird place where my age validation is not working, any ideas: $dob = strtotime($_POST['dob']); //855993600 Feb 15th 1997 $age_req = strtotime('-13 year', $dob); //445680000 Feb 15th 1984 $time = time(); //1292007621 if ($time < $age_req){} Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 10, 2010 Share Posted December 10, 2010 Presuming you are checking to see if someone is over/under a certain age requirement, this will give you their age in years. Then simply do your comparison. <?php $ageTime = strtotime($_POST['dob']); // Get the person's birthday timestamp $t = time(); // Store current time for consistency $age = ($ageTime < 0) ? ( $t + ($ageTime * -1) ) : $t - $ageTime; $year = 60 * 60 * 24 * 365; $ageYears = $age / $year; ?> Quote Link to comment Share on other sites More sharing options...
jp555soul Posted December 10, 2010 Author Share Posted December 10, 2010 I need to compare the age requirement to the dob not the date. 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.