Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Birthday format

From: Mike Blezien <mickalo(at)frontiernet.net>
Date: Mon Jun 25 2007 - 15:19:00 EDT


Chris,

  • Original Message ----- From: "Chris Boget" <chris.boget@wild.net> To: "Mike Blezien" <mickalo@frontiernet.net>; "MySQL List" <mysql@lists.mysql.com> 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

-- 
MySQL General Mailing List
For list archives: 
http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=lists@pantek.com
Received on Mon Jun 25 15:21:10 2007

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2007 - 15:30:02 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library