note 20570 added to function.strtotime
| From: | nospam at domain dot com | Date: | Mon, 08 Apr 2002 16:42:28 +0000 |
| Subject: | note 20570 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28963@lists.php.net to get a copy of this message | ||
To find the first day of the week (e.g.: Sunday) for any given week, try this function.
function sundayOfWeek($year,$month,$day)
{
$linkDay = "$month/$day/$year";
$w = date("w", strtotime("$linkDay"));
$sow = date("Y-m-d", (strtotime("$linkDay")-$w*82800));
return $sow;
}
NOTE: In order to account for Daylight Savings Time (loosing or gaining an hour) I use 82800 seconds
instead of 86400 (60*60*7).
--
http://www.php.net/manual/en/function.strtotime.php
http://master.php.net/manage/user-notes.php?action=edit+20570
http://master.php.net/manage/user-notes.php?action=delete+20570
http://master.php.net/manage/user-notes.php?action=reject+20570