Re: age function
| From: | Ryan A | Date: | Tue, 03 May 2005 20:09:59 +0000 |
| Subject: | Re: age function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-214401@lists.php.net to get a copy of this message | ||
Hey,
finally solved this, incase anyones interested heres how i did it :
$day1=strtotime($age); // eg: 1979-12-07
$day2 = strtotime(date("Y-m-d"));
$dif_s = ($day2-$day1);
$dif_d = ($dif_s/60/60/24);
$dif_y = round(($dif_d/365.24));
echo "The person is $dif_y year(s) old";
Cheers,
Ryan
----------------------------------
Hey,
Anybody have an age function where i can pass a date object and get back an
int?
eg:
$years_old=get_years("1979-12-07");
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.2 - Release Date: 5/2/2005