Skip to content

Instantly share code, notes, and snippets.

@vdonchev
Created July 28, 2022 07:33
Show Gist options
  • Save vdonchev/46bdc7450db0091a4283a63272322741 to your computer and use it in GitHub Desktop.
Save vdonchev/46bdc7450db0091a4283a63272322741 to your computer and use it in GitHub Desktop.
<?php
$now = new DateTime();
$run_01_start = (new DateTime())->setTime(0, 0);
$run_01_end = (new DateTime())->setTime(1, 0);
$run_02_start = (new DateTime())->setTime(12, 0);
$run_02_end = (new DateTime())->setTime(13, 0);
$run_03_start = (new DateTime())->setTime(18, 0);
$run_03_end = (new DateTime())->setTime(19, 0);
if (
($now >= $run_01_start && $now <= $run_01_end)
|| ($now >= $run_02_start && $now <= $run_02_end)
|| ($now >= $run_03_start && $now <= $run_03_end)
) {
echo 'Running :)';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment