title: How do I set first day of the week to Monday when using Week(Date) in PHP/MySQL?
body: <p>I am using the following code to build a Google Chart, to pull in all of entries in a MySQL table corresponding to the Week Numbers in a year.  At the moment the Week Numbers start on a Sunday, and I would like to change this so that they start on a Monday, but I'm not sure how to do this.</p>
  
  <pre><code>$i=1;
      while($i&lt;=53)
         {
          $week_start = new DateTime();
          $week_start-&gt;setISODate(2013,$i+1);
          $date_display = $week_start-&gt;format('j M Y');
  
          $sessions = $wpdb-&gt;get_var($wpdb-&gt;prepare("SELECT Sum(Due) from patient_sessions WHERE Type='Session' AND Week(Date)='$i'"));
  
          $temp = array();
  
          $temp[] = array('v' =&gt; (string) $date_display); 
          $temp[] = array('v' =&gt; (string) $sessions); 
          $rows[] = array('c' =&gt; $temp);
          $i++;
      }
  </code></pre>
  
  <p><strong>REVISED CODE</strong></p>
  
  <pre><code>$sessions = $wpdb-&gt;get_results($wpdb-&gt;prepare("SELECT Due,Date from patient_sessions WHERE Type='Session'"));
  $work_times = $wpdb-&gt;get_results($wpdb-&gt;prepare("SELECT Amount,Date from work_times"));
  $expenses = $wpdb-&gt;get_results($wpdb-&gt;prepare("SELECT Amount,Date from expenses WHERE Client='Psychotherapy'"));
  
  $i=1;
  while($i&lt;=53) {
      $week_start = new DateTime();
      $week_start-&gt;setISODate(2013,$i+1);
      $date_display = $week_start-&gt;format('j M Y');
  
      $session_total = 0;
      $work_time_total = 0;
      $expense_total = 0;
  
  
        foreach ($sessions as $session) {
      if (date("W", strtotime($session-&gt;Date)) == $i) {
      $session_total = ($session_total+$session-&gt;Due);
      }
      }
  
           foreach ($work_times as $work_time) {
      if (date("W", strtotime($work_time-&gt;Date)) == $i) {
      $work_time_total = ($work_time_total+$work_time-&gt;Amount);
      }
      }
  
            foreach ($expenses as $expense) {
      if (date("W", strtotime($expense-&gt;Date)) == $i) {
      $expense_total = ($expense_total+$expense-&gt;Amount);
      }
            }
  
      $balance = ($session_total + $work_time_total - $expense_total);
  
      $temp = array();
  
      $temp[] = array('v' =&gt; (string) $date_display); 
      $temp[] = array('v' =&gt; (string) $balance); 
      $rows[] = array('c' =&gt; $temp);
      $i++;
  }
  </code></pre>