The function you want, gets the date and time and checks if it is between monday to friday, and between 9:00 to 22:00 (10PM) is this:
function checkTime() {
var d = new Date()
var hours = d.getHours()
var mins = d.getMinutes()
var day = d.getDay()
return day >= 1
&& day <= 5
&& hours >= 9
&& hours < 22
}
This function just returns true or false, and if you want to do something with this, you just have to use it like this:
if (!checkTime()) { //If it is false (out of business hours)
console.log("We're not open now!") //you can place the command you want in here
}