Like PHP 5.3:
$paymentDate = DateTime::createFromFormat('d/m/Y', '31/12/2010');
$contractDateBegin = DateTime::createFromFormat('d/m/Y', '01/01/2001');
$contractDateEnd = DateTime::createFromFormat('d/m/Y', '01/01/2012');
if ($paymentDate >= $contractDateBegin && $paymentDate <= $contractDateEnd)
{
echo "is between\n";
}
You may need to tune the usage <=to <depending on whether the dates are exclusive.
source
share