After successfully implementing the code below for a specific time of day such as 4pm, I am now looking to extend its functionality. Ideally, I would like to be able to call this function at various other times throughout the day.
For example, I may want to trigger it at 7am, 11am, or even multiple times at 7am, 11am, and 4pm. Any assistance with achieving this flexibility would be highly appreciated.
setInterval(function interval(){
var now = new Date();
var time = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 14, 0, 0, 0) - now;
if (time < 0) {
time += 86400000;
}
setTimeout(function () {
my_function();
timeout();
}, time);
return interval;
}(),1800000);