date_default_timezone_set("Europe/Sofia");
$fisrt_date = $_GET["dateOne"];
$second_date = $_GET["dateTwo"];
$holidays = $_GET["holidays"];
$holidays = preg_split('/\\s+/', $holidays, -1, PREG_SPLIT_NO_EMPTY);
// var_dump($holidays);
$holidays_time = [];
foreach ($holidays as $holiday) {
    $holidays_time[] = strtotime($holiday);
}
$current_date = strtotime($fisrt_date);
$last_date = strtotime($second_date);
$work_days = [];
while ($current_date <= $last_date) {
    if (isWorkDay($current_date, $holidays_time)) {
        $work_days[] = $current_date;
    }
    $current_date = strtotime("+1 day", $current_date);
}
if (count($work_days) > 0) {
    echo "<ol>";
    foreach ($work_days as $work_day) {
        $workday_day = date("d-m-Y", $work_day);
        echo "<li>{$workday_day}</li>";
    }
    echo "</ol>";
} else {
    echo "<h2>No workdays</h2>";
}
function isWorkDay($current_date, $holidays_time)
Beispiel #2
0
 //当天
 $date = $startDate;
 //打卡标准时间
 $sign_early = strtotime($date . " 08:30");
 $sign_moning = strtotime($date . " 09:10");
 $sign_noon = strtotime($date . " 12:00");
 $sign_noon2 = strtotime($date . " 13:40");
 $sign_afternoon = strtotime($date . " 17:40");
 $sign_overtime = strtotime($date . " 18:50");
 //加班
 //当周
 $current_week = date('w', strtotime($date));
 //当天
 $current_day = date('d', strtotime($date));
 //排除特定日期
 if (isWorkDay($_REQUEST, $current_week, $current_day)) {
     //上班和下班打卡时间
     $arrSign = getCheckTime($db, $value['number'], $date);
     $on = $arrSign[0];
     $off = $arrSign[1];
     //备注
     $remark = "";
     //缺勤
     if ($on == null || $off == null) {
         $remark = "缺勤";
     } else {
         //有打卡记录
         if ($on != $off) {
             //迟到
             if ($on > $sign_moning && $on < $sign_noon) {
                 $remark = "迟到 ";