How to make a schedule (interval)?

We need to implement such a scheme. I have a script, do to the script execution schedule. That is pointing to the time, for example, from 10:00 to 23:00 (the script will work). And from 23:00 to 10:00 will not work. How to do that properly, without the crown? I have on the crown is the script run every 5 min.
Users I choose when the script will work. Can specify any time.

Here is an example of how I do:
$date = date("H:s");
$idat = date('00:40');

if(isset($date) && $date >= $idat) { $pub = 'the script Works'; } else { $pub = 'the script doesn't work'; }
echo $pub;


But this is not the right implementation, there compares not the time, and the figures
June 8th 19 at 16:38
1 answer
June 8th 19 at 16:40
Solution
Found a solution, but the author has deleted it. Anyways here so would be correct

$start_time = "07:30"; // Start
$end_time = "13:15"; // End

if ((date('H:i') > $start_time) && (date('H:i') < $end_time)) {
 echo 'Works';
} else { echo 'Not working'; }

Find more questions by tags PHP