Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript if time is between 7pm and 7am do this? Javascript If Statement Time Action

var hour = new Date().getHours();

// between 7 PM and 7 AM respectively
if(hour >= 19 || hour <= 7) {
    document.body.className += 'between7';
} else {
    document.body.className += 'notBetween7';
}
Copy
Source by localcoder.org #
 
PREVIOUS NEXT
Tagged: #Javascript #time #Javascript #If #Statement #Time #Action
ADD COMMENT
Topic
Name
8+5 =