06-21-2021 17:38
06-21-2021 17:38
I want a function to run every day for a clockface. How do I do this?
For example, generate a random number every day.
Thanks,
Techninja
06-21-2021 17:44
06-21-2021 17:44
Keep track of the date you last ran the function. If the current date is different from that, run the function (which should update the dateLastRun variable).
You may need to save the variable to the file system if you don't want it to get lost when your clockface closes.
06-22-2021 06:33
06-22-2021 06:33
Is there any type of "when" code?
let hours = today.getHours();
when(hours = 24) {
//Run Function
}
06-24-2021 07:16
06-24-2021 07:16
You can use setInterval() to make something happen at a specific time from now. Up to you to set when that is from now.
Author | ch, passion for improvement.