Belirli bir saat ve günde sayfamı yeniler bir işlevi var ama belirli bir zamanda belirli bir ay ve tarihte sadece yenileyebilirsiniz nasıl? Ben bunu yapmak istiyorum nedeni budur yalnızca belirli aylarda gerçekleşir futbol transferleri ilgili güncellemeler için Web sitem kontrolleri çünkü.
Burada bir günde belli bir zaman yenilemek için benim fonksiyondur
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);
}
}