get hour from date in datetime format sql code example Example: get hour from date sql SELECT DATEPART(HOUR, GETDATE());