if (!function_exists('calcWorkDay')) {
function calcWorkDay($startday, $daynum)
{
$currentTime = is_numeric($startday) ? $startday : strtotime($startday);
$currentTime = strtotime('-1 day', $currentTime);
$num = 0;
while($num <= $daynum)
{
$currentTime = strtotime('+1 day', $currentTime);
// 查询 是否为周六周日
$week = date('w', $currentTime);
// echo $num . '|||' . date('Y-m-d', $currentTime) .'|||'. $week.'<br \>';
if($week == 0 || $week == 6)
{
continue;
}
// 查询 是否节假日
$isrest = model('app\api\model\Calendar')->where('date', date('Y-m-d', $currentTime))->find();
if($isrest)
{
continue;
}
$num = $num + 1;
}
return date('Y-m-d', $currentTime);
}
}
计算工作日函数【计算距离某天几个工作日后的日期】
最新推荐文章于 2023-07-13 10:16:04 发布