I have a script function, and I created a trigger to run every hour
I need to stop that trigger at specific day and times for example I don't want to run it from Friday 5pm until Saturday 10pm
I found a function to stop it by day
//Skip week-end
var day = new Date();
if (day.getDay()>5 || day.getDay()==0) {
return;
}
but I don't know how to accomplish to be more specific from Friday 5pm until Saturday 10pm to don't run it
any help please ?
I think there is the simplest way it's skip current execution without re-create the trigger.
Suppose the days are hundreds:
500
600
Suppose the hours are dozens and units:
1
17
22
Then we have to pause between
500 + 17
and up to600 + 22
.You might want to include a check inside the trigger function to skip processing if the date and time fall in the specified period.