0
我正在尋找一個腳本,將只顯示不下週末的薪水日期。薪水PHP腳本
例如,該月的第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 />";
}
?>
任何幫助深表感謝。
謝謝先進。
究竟是什麼問題? – jeroen 2012-04-24 16:30:19
如果發薪日在週末,你通常不會在前一天收到款項嗎? – 2012-04-24 17:23:42