note 21393 deleted from function.mktime by jimw
| From: | jimw@php.net | Date: | Sat, 11 May 2002 22:54:05 +0000 |
| Subject: | note 21393 deleted from function.mktime by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30486@lists.php.net to get a copy of this message | ||
jon's method didn't seem very reliable (as it didn't calculate my age correctly ;)).
$birthday = "01/04/1963";
$break = explode("/",$birthday);
if($break[2] < 1970) {
$strip = 1970-$break[2];
$break[2] = 1970;
}
$date = mktime(0,0,0,date("m"),date("d"),date("Y"));
$bday = mktime(0,0,0,"$break[0]","$break[1]","$break[2]");
echo intval(($date-$bday)/31536000+$strip);