note 28453 added to ref.datetime
| From: | NO dot php at SPAM dot typetango dot com | Date: | Mon, 13 Jan 2003 21:52:56 +0000 |
| Subject: | note 28453 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42088@lists.php.net to get a copy of this message | ||
// returns person's age in years
// accepts person's birthday in 'Y-m-d' format
function find_age($birthday)
{ list($byear, $bmonth, $bday) = explode('-', $birthday);
list($cyear, $cmonth, $cday) = explode('-', date('Y-m-d'));
$cday -= $bday;
$cmonth -= $bmonth;
$cyear -= $byear;
if($cday < 0)
$cmonth--;
if($cmonth < 0)
$cyear--;
return $cyear;
}
--
http://www.php.net/manual/en/ref.datetime.php
http://master.php.net/manage/user-notes.php?action=edit+28453
http://master.php.net/manage/user-notes.php?action=delete+28453
http://master.php.net/manage/user-notes.php?action=reject+28453