Re: Age from birthdate?

From: Date: Wed, 22 Oct 2003 21:54:47 +0000
Subject: Re: Age from birthdate?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-167185@lists.php.net to get a copy of this message
On Thursday 23 October 2003 00:31, DvDmanDT wrote: > How would I get the age of someone if I store the birthdate in a date > field? I just realized FLOOR((UNIX_TIMESTAMP(NOW()) - > UNIX_TIMESTAMP(birthdate))/60/60/24/365.25) wont work for persons born > before 1970... :p I must get the current age in years, and I must be able > to select by age... :p Any ideas? If using MySQL: SELECT FROM_DAYS((TO_DAYS(NOW()) - TO_DAYS(dob))) as age or something. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Oh, yeah, life goes on, long after the thrill of livin' is gone. -- John Cougar, "Jack and Diane" */

« previous php.general (#167185) next »