List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 16 2003 11:28pm
Subject:Re: date functions
View as plain text  
At 17:24 -0500 2/16/03, Melih Onvural wrote:
>Hi all
>
>i'm new to the SQL programming language and i was trying to play 
>with a date/time counter of sorts. I was trying to teach myself the 
>various date functions, but I feel like I've failed. I had a 
>database with birthdates in it, and I subtracted that from date in 
>the Year() function and then subtracted 1900. Someone told me this 
>was really sloppy so I was wondering what's a better method to find 
>someone's age?
>
>Here's what I did
>
>Year(Date - BirthDate) - 1900
>
>(birthdate is the name of the field in the table)

Why not just look in the MySQL Reference Manual?  It has the formula
for computing ages.  The link to the manual appears at the bottom of
every message to this list.  Go there, type "age calculations" into
the search box, and it'll show you this link:

http://www.mysql.com/doc/en/Date_calculations.html

>
>thanks,
>melih

Thread
date functionsMelih Onvural17 Feb
  • Re: date functionsStefan Hinz17 Feb
  • Re: date functionsPaul DuBois17 Feb