x years old
| From: | Ryan A | Date: | Sun, 03 Jul 2005 00:01:57 +0000 |
| Subject: | x years old | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-218031@lists.php.net to get a copy of this message | ||
Hey guys,
This is the code I am using to display a persons age from the mysql db:
$day1=strtotime($age);
$day2 = strtotime(date("Y-m-d"));
$dif_s = ($day2-$day1);
$dif_d = ($dif_s/60/60/24);
$age = round(($dif_d/365.24));
but when someone entered their birth day($age) as 1988-07-06 it is showing
it as
17 years old instead of 16...any idea whats wrong in the above code?
Thanks,
Ryan