Back
I can extract the month and day by using Day(Date()), Month(Date()). I can't extract hours, with HOUR(Date()). I get the following error.
'HOUR' is not a recognized built-in function name.
How can I extract hours?
Try using below code:
SELECT DATEPART(HOUR, GETDATE());
For more information, you can refer to DATEPART documentation
DATEPART
31k questions
32.8k answers
501 comments
693 users