note 58212 deleted from function.mktime by derick

From: Date: Sun, 24 Sep 2006 11:52:40 +0000
Subject: note 58212 deleted from function.mktime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117503@lists.php.net to get a copy of this message
Note Submitter: pr10n at spymac dot com ---- This is the method I use to determine a user's age in years. Perhaps not as fancy as some others but it hasn't failed me yet. <?php function get_age($dob_stamp) { $dob = getdate($dob_stamp); $now = getdate(time()); $age = $now['year'] - $dob['year']; $age-= (int)($now['mon'] < $dob['mon']); $age-= (int)(($now['mon'] == $dob['mon']) && ($now['mday'] < $dob['mday'])); return $age; } ?>

« previous php.notes (#117503) next »