List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 24 1999 2:33pm
Subject:Re: age
View as plain text  
At 5:18 AM -0500 7/24/99, T¬ěnu Samuel wrote:
>Michael Farr wrote:
>
>> Hi, what is the easyest way to calculate someones age from their date of
>> birth? I have this, but is there something better?
>>
>> SELECT year(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(dOB))) FROM Person;
>
>Look at functions
>
>PERIOD_DIFF(P1,P2)
>DATE_ADD(date,INTERVAL expr type)
>DATE_SUB(date,INTERVAL expr type)
>ADDDATE(date,INTERVAL expr type)
>SUBDATE(date,INTERVAL expr type)


I don't understand this answer.  The last four functions return dates;
how do they give you an age?

--
Paul DuBois, paul@stripped
Thread
ageMichael Farr24 Jul
  • Re: agetonu24 Jul
    • Re: ageMichael Farr24 Jul
    • Re: agePaul DuBois24 Jul
      • Re: agetonu-mysql25 Jul
  • Re: agePaul DuBois24 Jul
    • BENCHMARK() (was: age)Martin Ramsch26 Jul
      • Re: BENCHMARK() (was: age)Paul DuBois26 Jul
        • Re: BENCHMARK() (was: age)Martin Ramsch26 Jul
Re: age(Timo Maier)26 Jul
  • Re: ageLindsay Davies27 Jul
Re: ageFulko Hew26 Jul