If you want it to be active for example between 10 am and 05:59 pm you can evaluate the current time and from there decide if to hide or show an element:
var fecha = new Date();
var hora = fecha.getHours();
if (hora > 9 && hora < 18) { // Aqui puedes checkear minutos, segundos y combinar criterios lógicos
document.getElementById("miModal").style.display = "block";
} else {
document.getElementById("miModal").style.display = "none";
}
Assuming you have an element that has an id="myModal" that element will appear between the indicated times.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="miModal" style="display: block;">
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</div>
<script>
var fecha = new Date();
var hora = fecha.getHours();
alert(hora);
if (hora > 9 && hora < 18) { // Aqui puedes checkear minutos, segundos y combinar criterios lógicos
document.getElementById("miModal").style.display = "none";
} else {
document.getElementById("miModal").style.display = "block";
}
</script>
</body>
</html>