note 44031 deleted from function.date by aidan

From: Date: Tue, 13 Jul 2004 13:36:08 +0000
Subject: note 44031 deleted from function.date by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73157@lists.php.net to get a copy of this message
Note Submitter: allen at ekonmat dot com ---- (Sorry about my poor english...) Calculate someone's age with year, month and day. If someone's birthday is 1975-11-19. ********** <?php $birthday = mktime(0, 0, 0, 11, 19, 1975); $ageyear = date("Y", time()) - date("Y", $birthday); $agemonth = date("m", time()) - date("m", $birthday); $ageday = date("d", time()) - date("d", $birthday); if ($ageday < 0) { $agemonth = $agemonth -1; $ageday = $ageday + 30; } if ($agemonth < 0) { $ageyear = $ageyear - 1; $agemonth = $agemonth + 12; } echo $ageyear . "year(s)" . $agemonth . "month(s)" . $ageday . "day(s)"; ?> **********

« previous php.notes (#73157) next »