You will need to add the hour of the day (as a number not time) to the messages, and then you can filter it in the search.
In your pipeline you can use .hourofday (see example in this link) Disable Graylog Alert on specific time - #3 by ericwu
Then write that value as a number to a field, then in your dashboard widget query include hour_of_day:[9 TO 17] or something like that.
You can do these for other things as well like .dayofweek etc.