SELECT
Lname + ' ' + Ename as Name,
DateOfBirth,
DATEDIFF(hour,dateOfBirth,GETDATE())/8766 AS Age
FROM EmpTBL
WHERE
DATEADD( Year, DATEPART( Year, GETDATE()) - DATEPART( Year, DateOfBirth), DateOfBirth)
BETWEEN CONVERT( DATE, GETDATE()) AND CONVERT( DATE, GETDATE() + 30);
The above query is what i use when i was testing inside the SQL it seems to work but when i add it to my ASP.net project the result is different, i already add "Convert(date, getdate()) " How to select date without time in SQL
Output from my project
Output from my SQL