sql datetime hour code example Example 1: get hour from date sql SELECT DATEPART(HOUR, GETDATE()); Example 2: sql datetime now SELECT GETDATE();