This question is an exact duplicate of:
I am using JavaScript code for refresh at specific time. I want to refresh the page at specific time and date. How can I add the date in this code?
function refreshAt(hours, minutes, seconds, day, month, year) {
var now = new Date('<?php echo date("d M Y H:i:s")?>');
var then = new Date('<?php echo date("d M Y H:i:s")?>');
if (now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setDay(day);
then.setMonth(month);
then.setYear(year);
then.setHours(hours);
then.setMinutes(minutes);
then.setSeconds(seconds);
var timeout = (then.getTime() - now.getTime());
setTimeout(function () {
window.location.reload(true);
window.location = "load.php";
}, timeout);
}
refreshAt(13, 12, 2013, 21, 25, 00);
</div>
I would recommend another approach, without JavaScript (pure HTML):
<meta http-equiv="refresh" content="<?php echo getRemainingSecondsToRefresh() ?>">