Functions between certain times of the day I'm working on something for my school's laptops that will disable videos/games between 8:00 AM and 3:15 PM. Due to the giant time gap, I will not be waiting to see if the code functions properly or not. What I want to know is if my code will function properly, as I'm not good enough at JavaScript to know myself.

function timer() {
    var date = new Date();
    var hours = date.getHours();
    var minutes = date.getMinutes();

    if (minutes &lt; 10) {
        var minutes = "0" + minutes;
    } else {}

    $(".time").html(hours + ":" + minutes),
        setInterval(timer, 1000);

    // Disable stuff
    if (hours &gt; 8 &amp; hours &lt; 15) {
        $("video").hide();
        $("video").parent().html("&lt;b&gt;Can you do us all a favor and not eat up all the bandwidth with your video watching?&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Thank you!&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;br/&gt;");
        $("embed").hide();
        $("embed").parent().html("&lt;b&gt;This is no time for childish games.&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Shouldn't you be studying or doing something related to school?&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;br/&gt;");
    } else if(hours &gt; 15 &amp; hours &lt; 8) {
        $("video").show();
        $("embed").show();
    }
}
I will comment on this part...

if (hours &gt; 8 &amp; hours &lt; 15) {
    $("video").hide();
    $("video").parent().html("&lt;b&gt;Can you do us all a favor and not eat up all the bandwidth with your video watching?&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Thank you!&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;br/&gt;");
    $("embed").hide();
    $("embed").parent().html("&lt;b&gt;This is no time for childish games.&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Shouldn't you be studying or doing something related to school?&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;br/&gt;");
} else if(hours &gt; 15 &amp; hours &lt; 8) {
    $("video").show();
    $("embed").show();
}


As Hosch said, you should be using the conditional operator &amp;&amp;.

Also, the else if clause wouldn't work because (hours &gt; 15 &amp;&amp; hours &lt; 8) is only true if hours &gt; 15 AND hours &lt; 8, so it's never true. What you want is the conditional "or" operator: if (hours &gt; 15 || hours &lt; 8). But you don't even need to specify that if what you want is just to cover all the other cases: "if it's between 8 AM and 3:15 PM do this, otherwise do that".

So...

else { ... }


looks better.

Finally, hours &gt; 8 &amp;&amp; hours &lt; 15 would only be true between 9 AM and 2 PM (instead of between 8 AM and 3 PM) as you're using the "greater than" (>) and "lesser than" (&lt;) operators instead of "greater or equal" (>=) and "lesser or equal" (&lt;=).

In order to cover the whole range you specified, you should write something like:

if ((hours &gt;= 8 &amp;&amp; hours &lt; 15) || (hours == 15 &amp;&amp; minutes &lt;= 15)) { ... }