Jump to content

How Old Is He ??!


kasper

Recommended Posts

hi all ,i am making a program with database , and i need a SQL satatement to:Calculate the age of persons in years , months and daysthe age is betwwn the birthdays and 5/12/2006for example : Goerge age is 30 years, 3 months and 24 days

Link to comment
Share on other sites

SELECT Name,Birthday,(DATEDIFF("dd",Birthday,getdate())/365) AS Years,(DATEDIFF("dd",Birthday,getdate())/365*12) AS Months,(DATEDIFF("dd",Birthday,getdate())) AS DaysFROM People

Well I played around with this query I made but just can't get the math right. It givews the total years, total months , and total days...not what you are looking for but I found this article that has a T-SQL function to get the exact number of years, months, and days are between 2 dates.http://www.dnzone.com/forum/topic.asp?topic_id=156I hope this at least gets you started.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...