[ create a new paste ] login | about

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

PHP, pasted on Jun 15:
<?php
	$from = time();
	$to = false;


	$days = get_weekdays($from);
	
	
	foreach($days as $day) {
		print date('l, F jS', $day).'<br>';
	}



/* FUNCTIONS */
	function get_weekdays ($from, $to=false) {
		if ($to == false)
			$to = last_day_of_month($from);
	
		$days = array();
	
		for ($x = $from; $x < $to; $x+=86400 ) {
			if (date('w', $x) > 0 && date('w', $x) < 6)
				$days[] = $x;
		}
		return $days;		
	}

	function last_day_of_month($ts=false) {
		$m = date('m', $ts);
		$y = date('y', $ts);
		return mktime(23, 59, 59, ($m+1), 0, $y);
	}
?>


Output:
1
Wednesday, June 15th<br>Thursday, June 16th<br>Friday, June 17th<br>Monday, June 20th<br>Tuesday, June 21st<br>Wednesday, June 22nd<br>Thursday, June 23rd<br>Friday, June 24th<br>Monday, June 27th<br>Tuesday, June 28th<br>Wednesday, June 29th<br>Thursday, June 30th<br>


Create a new paste based on this one


Comments: