<tfoot id='fUvoi'></tfoot>
        <bdo id='fUvoi'></bdo><ul id='fUvoi'></ul>

      1. <small id='fUvoi'></small><noframes id='fUvoi'>

      2. <legend id='fUvoi'><style id='fUvoi'><dir id='fUvoi'><q id='fUvoi'></q></dir></style></legend>

        <i id='fUvoi'><tr id='fUvoi'><dt id='fUvoi'><q id='fUvoi'><span id='fUvoi'><b id='fUvoi'><form id='fUvoi'><ins id='fUvoi'></ins><ul id='fUvoi'></ul><sub id='fUvoi'></sub></form><legend id='fUvoi'></legend><bdo id='fUvoi'><pre id='fUvoi'><center id='fUvoi'></center></pre></bdo></b><th id='fUvoi'></th></span></q></dt></tr></i><div id='fUvoi'><tfoot id='fUvoi'></tfoot><dl id='fUvoi'><fieldset id='fUvoi'></fieldset></dl></div>

      3. 如何在特定时区的特定时间刷新特定日期的页面?

        时间:2023-06-14
          <tbody id='poiGr'></tbody>
          <legend id='poiGr'><style id='poiGr'><dir id='poiGr'><q id='poiGr'></q></dir></style></legend>
          • <bdo id='poiGr'></bdo><ul id='poiGr'></ul>

            • <tfoot id='poiGr'></tfoot>

              <small id='poiGr'></small><noframes id='poiGr'>

                1. <i id='poiGr'><tr id='poiGr'><dt id='poiGr'><q id='poiGr'><span id='poiGr'><b id='poiGr'><form id='poiGr'><ins id='poiGr'></ins><ul id='poiGr'></ul><sub id='poiGr'></sub></form><legend id='poiGr'></legend><bdo id='poiGr'><pre id='poiGr'><center id='poiGr'></center></pre></bdo></b><th id='poiGr'></th></span></q></dt></tr></i><div id='poiGr'><tfoot id='poiGr'></tfoot><dl id='poiGr'><fieldset id='poiGr'></fieldset></dl></div>
                  本文介绍了如何在特定时区的特定时间刷新特定日期的页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个有两个背靠背网络广播的网站.我使用 PHP 来显示应该启用和禁用按钮的时间.现在我需要使用Javascript在第一次广播之前,第二次广播之前和第二次广播之后自动刷新页面.我实现了以下脚本,它确实在给定时间刷新了页面,但是,它并不能完全按照我的需要工作.我需要更改脚本,使其仅在美国东部标准时间周日晚上 7:45、晚上 8 点和晚上 8:30 刷新页面.

                  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.

                  我正在使用修改后的脚本 从这个回答的问题

                  I'm using a modified script from this answered question

                  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() 函数.

                  Then I call the refreshAt() function.

                  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
                  

                  我感到困惑的是如何更改此脚本以仅在周日为 EST 实现刷新.

                  Where I get confused is how to alter this script to only implement the refresh for EST on Sundays.

                  推荐答案

                  我想通了.这是脚本:

                  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);
                      }
                  }
                  

                  然后我只调用 refreshAt() 函数:

                  And then I just call the refreshAt() function:

                   refreshAt(20,00,0,1); //Will refresh the page at 8:00pm on Monday UTC or 3:00pm EST
                  

                  这篇关于如何在特定时区的特定时间刷新特定日期的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:消除 Javascript 夏令时差距,一种跨浏览器的解决方案 下一篇:jquery 链接是如何工作的?

                  相关文章

                    <legend id='vDQEs'><style id='vDQEs'><dir id='vDQEs'><q id='vDQEs'></q></dir></style></legend>
                    <i id='vDQEs'><tr id='vDQEs'><dt id='vDQEs'><q id='vDQEs'><span id='vDQEs'><b id='vDQEs'><form id='vDQEs'><ins id='vDQEs'></ins><ul id='vDQEs'></ul><sub id='vDQEs'></sub></form><legend id='vDQEs'></legend><bdo id='vDQEs'><pre id='vDQEs'><center id='vDQEs'></center></pre></bdo></b><th id='vDQEs'></th></span></q></dt></tr></i><div id='vDQEs'><tfoot id='vDQEs'></tfoot><dl id='vDQEs'><fieldset id='vDQEs'></fieldset></dl></div>
                  1. <small id='vDQEs'></small><noframes id='vDQEs'>

                    1. <tfoot id='vDQEs'></tfoot>
                      • <bdo id='vDQEs'></bdo><ul id='vDQEs'></ul>