note 99861 deleted from function.mktime by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Sep 2010 23:56:23 +0000 |
| Subject: | note 99861 deleted from function.mktime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172476@lists.php.net to get a copy of this message | ||
Note Submitter: Domenic Santangelo
----
Easiest way to calculate age based on a timestamped birthday:
$years_passed = date('Y') - date('Y', strtotime($your_timestamp));
if(date('md') < date('md', strtotime($your_timestamp))) {
$years_passed--;
}
return $years_passed;
Hackish, but date('md') will generate a four-digit number like 0914 (Sept. 14th) which
will be less than, say, 0522 (May 22nd).