note 36308 added to function.getdate

From: Date: Sat, 04 Oct 2003 14:19:32 +0000
Subject: note 36308 added to function.getdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-57809@lists.php.net to get a copy of this message
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() ---- Manual Page -- http://www.php.net/manual/en/function.getdate.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36308 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36308&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36308&report=yes Search Tool -- http://master.php.net/manage/user-notes.php

« previous php.notes (#57809) next »