note 39457 deleted from function.date by irchtml
| From: | irchtml@php.net | Date: | Wed, 25 Feb 2004 14:17:07 +0000 |
| Subject: | note 39457 deleted from function.date by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65720@lists.php.net to get a copy of this message | ||
Note Submitter: monitio@spamaway.hotmail.com
----
As a reply to eric_zander at yahoo dot com's DoB script, I should add that it can be done much
easier with this little snippet:
<?php
# Convert a date of birth to current age.
#
# Example (for 11 april, 1985): dob2age(11, 04, 1985);
# Should return: 18 (on the day of this post)
#
function dobToAge($d, $m, $y)
{
if (date("m") >= $m && date("d") >= $d)
$age = date("Y")-$y;
else
$age = date("Y")-$y-1;
return $age;
}
?>