Vitalitasia: Webpage bei einer bestimmten Zeit aktualisieren

Beitrag lesen

Ich habe folgenden Code gefunden, weiß nun aber nicht, wie ich diesen Teilcode lauffähig bekommen kann:

  
function refreshAt(hours, minutes, seconds) {  
var now = new Date();  
var then = new Date();  
  
if(now.getUTCHours() > hours ||  
   (now.getUTCHours() == hours && now.getUTCMinutes() > minutes) ||  
    now.getUTCHours() == hours && now.getUTCMinutes() == minutes && now.getUTCSeconds() >= seconds) {  
    then.setUTCDate(now.getUTCDate() + 1);  
}  
then.setUTCHours(hours);  
then.setUTCMinutes(minutes);  
then.setUTCSeconds(seconds);  
  
var timeout = (then.getTime() - now.getTime());  
setTimeout(function() { window.location.reload(true); }, timeout);  
}
refreshAt(19,45,0); //Will refresh the page at 7:45pm  
refreshAt(20,00,0); //Will refresh the page at 8:00pm  
refreshAt(20,30,0); //Will refresh the page at 8:30pm