note 36308 deleted from function.getdate by victor

From: Date: Sat, 04 Oct 2003 15:21:16 +0000
Subject: note 36308 deleted from function.getdate by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57811@lists.php.net to get a copy of this message
Note Submitter: phpnote@rhuvok.com ---- In response to selino at selino dot com - this function will give you the week in the month that a certain day is. <?php function getWeekInMonth($date_array) { $m = $date_array['mday']; $wim = 0; while ($m > 0) { $wim++; $m -= 7; } } ?> So you can use the 'weekday' element in the array to find the weekday and this function will tell you if that is the 1st, 2nd, 3rd, 4th or 5th such weekday. $m is just the day of the month so you can obtain that however you want - this example uses the array from getdate()

« previous php.notes (#57811) next »