如何檢查是生日是在本週,2周或月內我使用下面的代碼來檢查,但它返回錯誤的計算。檢查upcomming生日在一個星期2周或在一個月內使用php
public function CountDown($birthdate, $days=7)
{
list($y,$d,$m) = explode('/',$birthdate);
$today = time();
$event = mktime(0,0,0,$m,$d,$y);
$apart = $event - $today;
if ($apart >= -86400)
{
$myevent = $event;
}
else
{
$myevent = mktime(09,0,0,$m,$d,$y);
}
$countdown = round(($myevent - $today)/86400);
if ($countdown <= $days)
{
return true;
}
return false;
}
你想檢查'$ birthdate'是否在下一個'$ days'天? –
我想查看出生日期是否在'$ days'內 – magelearner