In this tutorial, We will learn how to check the current date is between the start date and end date in PHP.
Example:
<?php
$currentDate = date('Y-m-d');
$currentDate = date('Y-m-d', strtotime($currentDate));
$startDate = date('Y-m-d', strtotime("01/09/2020"));
$endDate = date('Y-m-d', strtotime("01/10/2021"));
if (($currentDate >= $startDate) && ($currentDate <= $endDate)){
echo "
";
}else{
echo "Current date is not between two dates";
}
output:
Current date is between two dates |