我正在寻找一个只显示不属于周末的工资日期的脚本。
例如,当月的第 1 日、第 15 日和最后一天可以是工资日期,但如果日期是周末,则将显示下一个工作日。
这是迄今为止所做的...
<?php
date_default_timezone_set('UTC');
function firstDayOftheMonth($month){
return date('j',mktime(1,1,1,$month,1,date('Y')));
}
function lastDayOfTheMonth($month){
return date('j',mktime(-1,-1,-1,$month+1,1,date('Y')));
}
function daysInMonth($month){
return cal_days_in_month($calendar, $month, date('Y'));
}
function getDay($day, $month){
return date('l', mktime(0, 0, 0, $month, $day, date('Y')));
}
// Set year and month variables.
$months = 12;
echo "<strong>Month Name, 1st Expenses Day, 2nd Expenses Day, Salary Day</strong><br />";
// Loop through months
for($month=1; $month <= $months; $month++){
echo "<strong>" . date('F', mktime(1, 1, 1, $month, 1, date('Y'))) . "</strong><br />";
// Get No# days for each month of the year.
$days = daysInMonth($month);
// Loop through all days of the month.
for($d=1; $d <= $days; $d++){
// Get textual days
$day = getDay($d, $month);
if($d==firstDayOftheMonth($month) || $d==lastDayOfTheMonth($month) || $d==15){
echo $d . ", " . $day . ", " . date('Y') . "<br />";
}
}
echo "<hr />";
}
?>
任何帮助深表感谢。
先谢谢了。