Calculating week of specified date
<p>Does PHP calculate weeks as being Sunday - Saturday? For a given date I am trying to determine the beginning and ending date of it's week as well as the beginning date of the next/previous weeks. Everything works fine unless I pass in a Sunday and it thinks the date is in a previous week.</p>

<pre><code>$start  = $_GET['start'];
$year = date('Y', strtotime($start));
$week = date('W', strtotime($start));
$sunday = strtotime($year.'W'.$week.'0');

$next  = strtotime('+7 Days', $sunday);
$prev  = strtotime('-7 Days', $sunday);

echo '&lt;p&gt;week: ' . $week . '&lt;/p&gt;';
echo '&lt;p&gt;sunday: ' . date('Y-m-d', $sunday) . '&lt;/p&gt;';
echo '&lt;p&gt;next:' . date('Y-m-d', $next) . '&lt;/p&gt;';
echo '&lt;p&gt;prev: ' . date('Y-m-d', $prev) . '&lt;/p&gt;';
</code></pre>

<p>Outcome:</p>

<pre><code>2011-01-09 (Sunday)
Week: 01
WRONG

2011-01-10 (Monday)
Week: 02
RIGHT

2011-01-15 (Saturday)
Week: 02
RIGHT
</code></pre>
