Had to figure this out today, and thought I’d post it here, because I didn’t see it anywhere else out there.
There maybe better ways of doing this. If so, please let me know.
--Check to see if current time is a weekday and between 9 and 5
DECLARE @isWorkHours AS bit
SELECT @isWorkHours = COUNT(1)
--Monday is 2 and Friday is 6.
DATEPART(dw,GETDATE()) BETWEEN 2 AND 6
--This gets times between 9:00 and 4:59
DATEPART(hour, GETDATE()) BETWEEN 9 AND 16
IF @isWorkHours = 1
IF @isWorkHours = 0