Hi I would like to execute this function between 8 and 10 o'clock. So it starts at 8 and it stops at 10 automatically. I have this code below, but it doesen seem to work, it wont execute if passes 8 o'clock.
var timeOut1 = setTimeout(function () {
var date = new Date();
if ((date.getHours() >= 20 && date.getMinutes() >= 00) || (date.getHours() <= 22 && date.getMinutes() <= 00)) {
$('#myModal').modal('show');
}
}, 1000);
document.write(timeOut1);
I tried setInterval alsoCan someone help me with this?