I have a relatively simple question. I have a redirection script that works fine based on the time of day. I want to expand the script a bit to allow it to work based on day and time. The way it is now, the script works every day between the specified hours. I want to make it work only on a specified day and then between two specified hours. The second script below does not work and I suspect I am using the operators wrong.
//This first script works
var TLCGISwebsiteDown=””;
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
if (hours>=3) && (hours<6)) //execute based on day and time.
{
TLCGISwebsiteDown=”maintenance”;
if (hours==3)
{
TLCGISwebsiteDown=””;
}
}
if (TLCGISwebsiteDown==”maintenance”) {
window.location.href(“WebsiteDown.htm”);
}
//This second script does not work
var TLCGISwebsiteDown=””;
var now = new Date();
var thisday = now.getDay();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
if ((thisday==2) && (hours>=3) && (hours<6)) //execute based on day and time.
{
TLCGISwebsiteDown=”maintenance”;
if (hours==3)
{
TLCGISwebsiteDown=””;
}
}
if (TLCGISwebsiteDown==”maintenance”) {
window.location.href(“WebsiteDown.htm”);
}