note 84199 added to function.date

From: Date: Thu, 03 Jul 2008 02:44:51 +0000
Subject: note 84199 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-141100@lists.php.net to get a copy of this message
Slight amendment to halocastle at yahoo dot com 's code as it doesn't take into account when a month finishes on a Saturday (eg May 2008). $start_date = mktime(0, 0, 0,$start_month, 1, $start_year); $days_in_month = date('t', $start_date); $month_first_day = date('w', $start_date); $j = $month_first_day; $num_weeks = 1; for($i = 1; $i <= $days_in_month; $i++) { $j++; if($j == 7) { $j = 0; $num_weeks++; } } // if the last day of the month happens to be a Saturday, // take one off the number of weeks // because it was being added inside the for loop. if ($j == 0) { $num_weeks--; } ---- Server IP: 117.104.160.194 Probable Submitter: 203.206.174.100 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/84199 Del: integrated -- https://master.php.net/note/delete/84199/integrated Del: useless -- https://master.php.net/note/delete/84199/useless Del: bad code -- https://master.php.net/note/delete/84199/bad+code Del: spam -- https://master.php.net/note/delete/84199/spam Del: non-english -- https://master.php.net/note/delete/84199/non-english Del: in docs -- https://master.php.net/note/delete/84199/in+docs Del: other reasons-- https://master.php.net/note/delete/84199 Reject -- https://master.php.net/note/reject/84199 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141100) next »