Age from date field?
| From: | DvDmanDT | Date: | Sun, 12 Oct 2003 00:09:38 +0000 |
| Subject: | Age from date field? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-165867@lists.php.net to get a copy of this message | ||
Does anyone have a good solution on how to get the age of someone from a
date column in mysql... This is what I have, but it's not really the
truth... What's the right way to do it?
floor((time()-$a["born"])/(3600*24*365.25))
where $a["born"] is the timestamp of the birthdate... Current query:
SELECT UNIX_TIMESTAMP(birthdate) as born FROM members WHERE id='1'
So... how would I do it... Doesn't matter if it's MySQL or PHP that
calculates it, as long as I can expect it to work on paid hosts...
Any suggestions? Notice that I'm only looking for the age in years... Thanks
in advance
--
// DvDmanDT
MSN: dvdmandt@hotmail.com
Mail: dvdmandt@telia.com