Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

daily

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

Best Answer
0 Votes
3 REPLIES 3

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.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Is there any type of "when" code?

 

let hours = today.getHours();

when(hours = 24) {

  //Run Function

}

Best Answer
0 Votes

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.

Best Answer
0 Votes