• Jeff Moden (1/9/2013)


    AndrewSQLDBA (1/8/2013)


    Hello Everyone

    Happy New Year!!!

    I am fooling around with some code, and was wondering if there is a really great function to calculate the birthdate of a person. One that will take into count things like leap year. I am not getting into such fine details such as if the person was born on the west coast or the east coast type of calculations. Just a very good birthdate age calculation function.

    If I pass in the birthdate, what is the persons age today. Most that I have used or tried, come up a bit short when it comes to returning a perfect calculation

    Thanks in Advance

    Andrew SQLDBA

    So, which "standard" are you going to use for someone that is born on a leap year day? Feb 28th or Mar 1st? 😉

    As usual, no one agrees on this, but different countries do at least have some standard.

    http://en.wikipedia.org/wiki/February_29

    "...in England and Wales or in Hong Kong, a person born on February 29, 1996, will have legally reached 18 years old on March 1, 2014. If he or she was born in the United States, Taiwan or New Zealand, he or she legally becomes 18 on February 28, 2014, a day earlier..."

    I prefer the Feb 28 date for birthdays in non-leap years because that's the "standard" for the US. And, it's easier to code in TSQL.:-D