note 55543 added to function.date

From: Date: Sat, 06 Aug 2005 15:18:21 +0000
Subject: note 55543 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-93168@lists.php.net to get a copy of this message
here's a function to get (in years) a person's age based on their birthday function persons_age($year, $month, $day) { $tmonth = date('n'); $tday = date('j'); $tyear = date('Y'); $years = $tyear - $year; if ($tmonth <= $month) { if ($month == $tmonth) { if ($day > $tday) $years--; } else $years--; } return $years; } ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55543 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55543&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55543&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55543&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55543&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55543&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55543&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55543&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93168) next »