Redirecting based on the time of day is fairly easy to do. One thing to remember, however, is that because client-side JavaScript runs in the user’s browser, the time your code will be working with is the time set on the user’s machine, not your Web server. This factor is especially important if your site gets a lot of international visitors. That said, here’s one way to code a time-based redirect: