如何检查当前日期是否在假期日期范围内?我有一个包含两个 DATE 列 start_date 和 end_date 的“假期”表。用户可以在该范围内定义假期日期。我需要创建一个循环来检查假日日期范围内的当前日期,如果是,则当前日期变为“+1 天”,然后再次检查。到目前为止,我已经做到了:
<?php
include ("config.php");
$curdate = date('Y-m-d', time());
$res = mysql_query("SELECT * FROM holidays WHERE '$curdate' BETWEEN `start_date` and `end_date`");
$resu = mysql_num_rows($res);
if ($resu == NULL)
{
echo "Date is not range";
}
else
{
echo "Date is in range";
}
?>