sql query to get only hour from date code example Example: get hour from date sql SELECT DATEPART(HOUR, GETDATE());