<?php function isDateValid(DateTime $checkDate, DateTime $startDate, DateTime $endDate) { return ($checkDate > $startDate && $checkDate < $endDate) ? true : false; } $checkDate = new DateTime("2016-06-15"); $startDate = new DateTime("2016-06-10 12:00"); $endDate = new DateTime("2016-06-20 12:00"); $isDateValid = isDateValid($checkDate, $startDate, $endDate); if($isDateValid){ echo "Valid"; }else{ echo "Invalid"; }
You have javascript disabled. You will not be able to edit any code.