Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
Displaying Open or Closed Status based on Time and Day

What is the easiest way to display "We are Open/Closed" on a web page based on the day and time it is.

I found the code here, but it doesn't take into consideration time zones. How do I modify the script to display the open/closed status based on timezone?

What I have so far.

<span id="hoursofoperation"></span>
<script>
    var a = document.getElementById("hoursofoperation");
    var d = new Date();
    var n = d.getDay();
    var now = d.getHours() + "." + d.getMinutes();
    var weekdays = [
        ["Sunday", 9.30, 12.00, 15.30,22.00],
        ["Monday", 8.30, 12.00, 15.30,19.00],
        ["Tuesday", 8.30, 12.00, 15.30,19.00],
        ["Wednesday", 8.30, 12.00, 15.30,19.00],
        ["Thursday", 8.30, 12.00, 15.30,19.00],
        ["Friday", 8.30, 11.30],
        ["Saturday"] // we are closed, sorry!
    ];
    var day = weekdays[n];


    if (now > day[1] && now < day[2] || now > day[3] && now < day[4]) {
        a.innerHTML = "We are Open.";
    }
     else {
        a.innerHTML = "We are Closed.";
    }


</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Just use .getUTCHours and .getUTCMinutes instead.

Make sure to also convert your table to UTC times.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!