Van egy funkció, amely felfrissíti az oldalamon egy adott napon és időpontban, de hogyan tudok frissíteni csak egy adott hónap és nap egy bizonyos ideig? Az ok, amiért szeretnék, hogy ezt is, mert a honlap frissítéseket keres a futball átutalások csak akkor kerül sor a konkrét hónap.
Itt van a funkció, hogy frissítse bizonyos ideig egy nap
function refreshAt(hours, minutes, seconds, day) {
var now = new Date();
var then = new Date();
var dayUTC = new Date();
if(dayUTC.getUTCDay() == day) {
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);
}
}