[ create a new paste ] login | about

Link: http://codepad.org/D3zU1DSA    [ raw code | fork ]

PHP, pasted on Jun 25:
1
2
3
4
5
6
7
8
9
10
11
12
function get_working_days($date, $backwards = TRUE, $num_days = 3) {
	$holidays = get_holidays(date('Y', strtotime($date)));
	$direction = $backwards ? 'last' : 'next';
	$working_days = array();

	do {
		$date = date('Y-m-d', strtotime($direction.' weekday', strtotime($date)));
		if (!in_array($date, $holidays)) $working_days[] = $date;
	}	while (count($working_days) < $num_days);

	return ($direction) ? array_reverse($working_days) : $working_days;
}


Create a new paste based on this one


Comments: