note 64289 added to function.date

From: Date: Tue, 11 Apr 2006 18:43:44 +0000
Subject: note 64289 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-107791@lists.php.net to get a copy of this message
Here is a little function I use to calculate the current age of a person based on his/her birthday. Hope it comes handy to anyone. // calculate age based on birthday function getAge($birthday) // date time { return date('Y') - date('Y', $birthday) - 1 + (int)((date('m', $birthday) <= date('m')) && (date('d', $birthday) <= date('d'))); } Cheers, André ---- Server IP: 217.160.72.57 Probable Submitter: 212.144.115.126 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/note/edit/64289 Del: integrated -- http://master.php.net/note/delete/64289/integrated Del: useless -- http://master.php.net/note/delete/64289/useless Del: bad code -- http://master.php.net/note/delete/64289/bad+code Del: spam -- http://master.php.net/note/delete/64289/spam Del: non-english -- http://master.php.net/note/delete/64289/non-english Del: in docs -- http://master.php.net/note/delete/64289/in+docs Del: other reasons-- http://master.php.net/note/delete/64289 Reject -- http://master.php.net/note/reject/64289 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107791) next »