check if date is between two dates php code example
Example 1: php get day diff
$now = time();
$your_date = strtotime("2010-01-31");
$datediff = $now - $your_date;
echo round($datediff / (60 * 60 * 24));
Example 2: php get date between two dates
$period = new DatePeriod(
new DateTime('2010-10-01'),
new DateInterval('P1D'),
new DateTime('2010-10-05')
);
foreach ($period as $key => $value) {
}
Example 3: how to calculate days difference between two dates in php
use DateTime;
$startDate = new DateTime($request->start_date);
$endDate = new DateTime($request->end_date);
$daysDifference = ($startDate->diff($endDate)->days);