How can I figure out how old someone is based on a DateTime birthday ?

Forums SQLHow can I figure out how old someone is based on a DateTime birthday ?
Staff asked 2 years ago

Answers (1)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 2 years ago

You can try this :

declare @dob varchar(MAX) = '2003-05-04 00:00:00'
select CONVERT(int,ROUND(DATEDIFF(hour,@dob,GETDATE())/8766.0,0))

 

Subscribe

Select Categories