note 64785 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 11 Jun 2006 11:45:56 +0000 |
| Subject: | note 64785 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114263@lists.php.net to get a copy of this message | ||
Note Submitter: mwj24
----
This is a bug fix to age calculator below, submitted apr 11
<?php
// calculate age based on birthday
function getAge($birthday) // date time
{
$Y =date('Y', $birthday);
$m =date('m', $birthday);
$d =date('d', $birthday);
return getAgeMDY($m,$d,$Y);
}
function getAgeMDY($m,$d,$Y)
{
return date('Y') - $Y - 1 + (int)(($m <= date('m') && $d <=
date('d')) || ($m < date('m')) );
}
?>
Cheers,
Mark