note 77840 added to function.date
| From: | minterior at gmail dot com | Date: | Sat, 15 Sep 2007 08:46:05 +0000 |
| Subject: | note 77840 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130508@lists.php.net to get a copy of this message | ||
<?php
/**
* Calculate how old is a person with the birth date given
*/
function calculateYearsOld($bday, $bmonth, $byear) {
$years = date("Y") - intval($byear);
//If birthday is after today, he/she has one year old less
$day = str_pad(intval($bday), 2, "0", STR_PAD_LEFT);
$month = str_pad(intval($bmonth), 2, "0", STR_PAD_LEFT);
if(intval("$month$day") > intval(date("md")))
$years -= 1;
return $years;
}
?>
----
Server IP: 80.64.47.13
Probable Submitter: 80.35.139.151
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/77840
Del: integrated -- https://master.php.net/note/delete/77840/integrated
Del: useless -- https://master.php.net/note/delete/77840/useless
Del: bad code -- https://master.php.net/note/delete/77840/bad+code
Del: spam -- https://master.php.net/note/delete/77840/spam
Del: non-english -- https://master.php.net/note/delete/77840/non-english
Del: in docs -- https://master.php.net/note/delete/77840/in+docs
Del: other reasons-- https://master.php.net/note/delete/77840
Reject -- https://master.php.net/note/reject/77840
Search -- https://master.php.net/manage/user-notes.php