function date_calc_next_weekday in Date 6
Same name and namespace in other branches
- 5.2 date_php4/date_php4_calc.inc \date_calc_next_weekday()
- 6.2 date_php4/date_php4_calc.inc \date_calc_next_weekday()
Returns date of the next weekday of given date, skipping from Friday to Monday.
Parameters
int $day: The day of the month.
int $month: The month.
int $year: The 4 digit year. Do not add leading 0's for years prior to 1000.
string $format: The string indicating how to format the output.
Return value
string The date in the desired format.
File
- date_php4/
date_php4_calc.inc, line 943
Code
function date_calc_next_weekday($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT) {
if (empty($year)) {
$year = date_calc_get_year();
}
if (empty($month)) {
$month = date_calc_get_month();
}
if (empty($day)) {
$day = date_calc_get_day();
}
$days = date_calc_date_to_days($day, $month, $year);
if (date_dow($day, $month, $year) == 5) {
$days += 3;
}
elseif (date_dow($day, $month, $year) == 6) {
$days += 2;
}
else {
$days += 1;
}
return date_calc_days_to_date($days, $format);
}