Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to refresh page on specific day at specific time in specific time zone?
    text
    copied!<p>I am developing a website that has two back to back web broadcasts. I have used PHP to display the time that the buttons should be enabled and disabled. Now I need to use Javascript to automatically refresh the page before the first broadcast, before the second broadcast and after the second broadcast. I implemented the following script and it does refresh the page at the given time, however, it doesn't work exactly as I need it to. I need to alter the script so that it refreshes the page on Sundays at 7:45pm, 8pm and 8:30pm EST only.</p> <p>I'm using a modified script <a href="https://stackoverflow.com/questions/1217929/how-to-automatically-reload-a-web-page-at-a-certain-time">from this answered question</a></p> <pre><code>function refreshAt(hours, minutes, seconds) { var now = new Date(); var then = new Date(); if(now.getUTCHours() &gt; hours || (now.getUTCHours() == hours &amp;&amp; now.getUTCMinutes() &gt; minutes) || now.getUTCHours() == hours &amp;&amp; now.getUTCMinutes() == minutes &amp;&amp; now.getUTCSeconds() &gt;= 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); } </code></pre> <p>Then I call the refreshAt() function.</p> <pre><code>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 </code></pre> <p>Where I get confused is how to alter this script to only implement the refresh for EST on Sundays.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload