note 55637 deleted from function.date by derick

From: Date: Sun, 15 Jan 2006 12:43:27 +0000
Subject: note 55637 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-101831@lists.php.net to get a copy of this message
Note Submitter: angstsix at gmail dot com ---- same code as djneoform at gmail dot com, but added the split function to make things a little simpler for getting age from birthdate <? function persons_age($BirthDate) { list($year, $month, $day) = split('[-.]', $BirthDate); $tmonth = date('n'); $tday = date('j'); $tyear = date('Y'); $years = $tyear - $year; if ($tmonth <= $month) { if ($month == $tmonth) { if ($day > $tday) $years--; } else $years--; } echo $years; } persons_age('1978-12-06') ?>

« previous php.notes (#101831) next »