note 19237 deleted from function.mktime by jimw
| From: | jimw@php.net | Date: | Sat, 11 May 2002 22:53:07 +0000 |
| Subject: | note 19237 deleted from function.mktime by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30482@lists.php.net to get a copy of this message | ||
to work out how old someone is in years that also accounts for people born before 1970 (developed on
a win32 platform) i used:
$intDOBday = "21";
$strDOBmonth = "feb";
$intDOByear = "1981";
$dob = "$intDOBday$strDOBmonth$intDOByear";
$age = date("Y") - substr($dob,-4);
if ($a_M[substr($dob,2,3)] > $a_M[strtolower(date("M"))]) --$age;
if ($a_M[substr($dob,2,3)] == $a_M[strtolower(date("M"))]) { if(floor(substr($dob,0,2))
> floor(date("d"))) --$age; }
echo "final age = $age";