Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8647167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:59:48+00:00 2026-06-12T12:59:48+00:00

I’m trying to force a page to refresh with js at a specific time,

  • 0

I’m trying to force a page to refresh with js at a specific time, after digging around I found the script below. However, it doesn’t appear to take into consideration timezones. How would I implement that?

<html>
<head>
<title></title>
<script type="text/javascript">
function refreshAt(hours, minutes, seconds) {
    var now = new Date();
    var then = new Date();

    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.setHours(hours);
    then.setMinutes(minutes);
    then.setSeconds(seconds);

    var timeout = (then.getTime() - now.getTime());
    setTimeout(function() { window.location.reload(true); }, timeout);
}

refreshAt(15,06,0); //Will refresh the page at 3:06pm
</script>
</head>
<body onLoad="setInterval('getCurrentTime()', 1000);">
<div id="time"></div>
content
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:59:49+00:00Added an answer on June 12, 2026 at 12:59 pm

    Here you go, reload will occur for every user exactly as you define in global vars in script:

    EDIT!!! I had bug in code so I have updated the script…

    EDIT working example:
    http://simplestudio.rs/yard/tinediffredir/content.html

    <html>
        <head>
            <title>Chk diff and reload if match</title>
    
            <script>
    
                var reload_time = "15060"; // this is 15:06:00 - change to desired reload time
                var reload_hour_diff = 15; // for cheking diff - change to desired hours
                var reload_minute_diff = 6; // for cheking diff - change to desired minutes
                var time_zone_offset = "-5"; // globally looking from GMT time, change this according to DST
    
                var reload_time_checker = setInterval(function(){reload_page()},300);
                var diff = null;
    
                function chk_reload_moment(offset) {
    
                    dat = new Date();
    
                    utc = dat.getTime() + (dat.getTimezoneOffset() * 60000);
    
                    default_date = new Date(utc + (3600000*offset));
    
                    var default_year = default_date.getFullYear();
                    var default_month = default_date.getMonth();
                    var default_day = default_date.getDate();
                    var default_hour = default_date.getHours();
                    var default_minutes = default_date.getMinutes();
                    var default_seconds = default_date.getSeconds();
    
                    user_date = new Date();
    
                    var user_year = user_date.getFullYear();
                    var user_month = user_date.getMonth();
                    var user_day = user_date.getDate();
                    var user_hour = user_date.getHours();
                    var user_minutes = user_date.getMinutes();
                    var user_seconds = user_date.getSeconds();
    
                    user_current = user_hour+""+user_minutes+""+user_seconds;
    
                    default_current_f = default_day+"/"+default_month+"/"+default_year+" "+default_hour+":"+default_minutes+":"+default_seconds;
                    user_current_f = user_day+"/"+user_month+"/"+user_year+" "+user_hour+":"+user_minutes+":"+user_seconds;
    
                    var timeEnd = new Date(user_current_f);
                    var timeEndH = timeEnd.getHours();
                    var timeEndM = timeEnd.getMinutes();
    
                    var new_reload_minute_diff = 60+reload_minute_diff;
                    diff = (timeEndH - reload_hour_diff + 12) + " hours " + (new_reload_minute_diff - timeEndM) + " minutes";    
    
                    if (user_current == reload_time) {
    
                        return true;
    
                    }
                    else {
    
                        return false;
    
                    }
    
                }
    
                function reload_page() {
    
                    var chktime = chk_reload_moment(time_zone_offset);
                    if (chktime) {
    
                        window.location.reload();
    
                    }
                    else {
    
                        var timer_div = document.getElementById('timer');
                        timer_div.innerHTML = "remaining: " + diff + " until new content";
    
                    }
    
                }
    
            </script>
    
        </head>
        <body>
    
            <div id="timer">
    
            </div>
    
        </body>
    </html>
    

    I think it is clear how to configure it but if you have some problems feel free to ask…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.