List:General Discussion« Previous MessageNext Message »
From:Mike Blezien Date:June 25 2007 7:19pm
Subject:Re: Birthday format
View as plain text  
Chris,

----- Original Message ----- 
From: "Chris Boget" <chris.boget@stripped>
To: "Mike Blezien" <mickalo@stripped>; "MySQL List" 
<mysql@stripped>
Sent: Monday, June 25, 2007 2:15 PM
Subject: Re: Birthday format


>> we have a simple query to calculate someones birthday:
>> SELECT (TO_DAYS(CURDATE()) - TO_DAYS('1952-10-06')) / 365;
>> = 54.75
>> Now is there away, using SQL, to remove the .75 without rounding off. we just 
>> want the '54' value. We can do it easy enough with our Perl programming, but 
>> was wondering if this can be accomplished within the actual query itself.
>
> Wouldn't this work
>
> SELECT FLOOR((TO_DAYS(CURDATE()) - TO_DAYS('1952-10-06')) / 365 ) AS age
>
> ?  What version of mysql are you using?
>
> thnx,
> Chris

Ok, this worked fine, thanks. We're using  Ver., 4.1.22

Mike 
Thread
Birthday formatMike Blezien25 Jun
  • Re: Birthday formatChris Boget25 Jun
  • Re: Birthday formatMike Blezien25 Jun
  • RE: Birthday formatJerry Schwartz25 Jun
  • Re: Birthday formatMike Blezien25 Jun
    • Re: Birthday formatMike Aubury25 Jun
  • Re: Birthday formatMike Blezien25 Jun