更新时间:2023-01-27 17:27:05
从PHP 5.3开始:
As of 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 adjust the use of <=
to <
depending on whether or not the dates are exclusive.