note 19512 added to function.date
| From: | bjorn at noname4us dot com | Date: | Fri, 01 Mar 2002 14:31:40 +0000 |
| Subject: | note 19512 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27226@lists.php.net to get a copy of this message | ||
Whoops, accidently switched the order in the inline if. Here is the correct version :o)
function get_date_from_week($year, $week)
{
$first_day = strtotime($year."-01-01");
$is_monday = date("w", $first_day) == 1;
$is_weekone = strftime("%V", $first_day) == 1;
if($is_weekone)
{
$week_one_start = $is_monday ? $first_day : strtotime("last monday", $first_day);
}
else
{
$week_one_start = strtotime("next monday", $first_day);
}
return $week_one_start+(3600*24*7*($week-1));
}
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+19512
http://master.php.net/manage/user-notes.php?action=delete+19512
http://master.php.net/manage/user-notes.php?action=reject+19512