Überprüfen Sie die Zeit JavaScript

var objDate = new Date();
var hours = objDate.getHours();
if(hours >= 12 && hours <= 21){
    document.write('We Are Closed');
}
else{
    document.write('We are Open');
}
MajorMFR