sql age function

Preview Content - log in or Join KEBI Academy

If you are after accurate way to calculate Age using T-SQL then the below post might help you.

Below are questions that I try to answer in this post:

  • How to get age from birth date using getdate() (current date) in Tsql
  • How to calculate age from date of birth (DOB) and specified date
  • How to create T-SQL aging UDF function to calculate age from DOB and today's date or specified date
  • Calculate person's age (Accurate age calculation)

    T-SQL Age - years difference

    The above example show difference in years so it is not accurate. If you need accuracy than please use the code below.

Want full access? log in or try 7 days FREE trial
5 reasons to join KEBI Academy
7 days FREE trial
Did you find this page useful? +6  |  -0
(6 Votes)

I se a similar concept when checking lease expiry or doing period banding. Period with Fields like FinanceYear and FinanceMonth by if (CurrentFY*12+CurrentFM)-SoldFY*12+SoldFM)>12 -- then collect rent
Precise Explanation to why the approach was needed. Solid working example