Source Code:
(back to article)
<?php $start = new DateTime('2022-01-01'); $end = new DateTime('2022-12-31'); $check = new DateTime('2022-06-15'); if ($check >= $start && $check <= $end) { echo 'The date is within the range.'; } else { echo 'The date is not within the range.'; }
Result:
Report an issue