note 10483 deleted from function.date by jimw

From: Date: Fri, 02 Nov 2001 00:53:12 +0000
Subject: note 10483 deleted from function.date by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20068@lists.php.net to get a copy of this message
These routines will build the perfect array for making calendar. function daysinmonth($month,$year) { $x=1; while(checkdate($month,$x,$year)) { $x++; } return $x-1; } function build_month_array($month, $year) { $current_week = 0; $first_time = 1; for($x=1;$x<=daysinmonth($month,$year);$x++){ $dow = date("w",mktime(0,0,0,$month,$x,$year)); if($dow == 0) { if($first_time == 0) { $current_week++; } } $cal[$current_week][$dow] = $x; $first_time=0; } return $cal; }

« previous php.notes (#20068) next »