Advertisement
giammin

Calculate age from date of birth

Jul 2nd, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.16 KB | None | 0 0
  1. DECLARE @birthday datetime = '1977-05-25T00:00:00'
  2.  
  3. SELECT DATEDIFF(yy, @birthday, GETDATE()) AS YearAge,
  4.        DATEDIFF(hour,@birthday,GETDATE())/8766 AS RealAge
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement