title: new Date into Array php
body: <p>For Google Visualization I coded the JSON by hand (Messy I know) I did not think about <code>'</code>'s in <code>NAME_TEAM</code> which has recently come about an issue as my first team name was entered with an apostrophe. I have read <a href="https://stackoverflow.com/questions/13262826/how-do-you-deal-with-single-quote-in-persons-names-in-php-javascript">this post</a> and tried to implement php <code>json_encode</code>. I am having an issue with the dates. The <code>new Date</code> works fine in the old messy json format, however I get an error <code>Fatal error: Class 'Date'</code> when I try use anything similar for the Json_encode version. The format must be date for the visualization api to understand the values.</p>
  
  <pre><code>foreach ($data as $row) {
  $dateArray = explode('-', $row['THE_DATE']);
  $year = $dateArray[0];
  $month = $dateArray[1] - 1;
  $day = $dateArray[2];
  $dataArray[] = "[new Date ($year, $month, $day),  {$row['ORANGE']}, {$row['GREEN']}, '{$row['NAME_TEAM']}']";
  
  
  $itemOutput[] = array(
  new Date($year, $month, $day),
  $row['ORANGE_SCORE'],
  $row['GREEN_SCORE'],
  $row['NAME_TEAM'],
  );
  }
  echo "data.addRows(" . json_encode($itemOutput) . ");" ;
  </code></pre>
  
  <p><strong>Data Table creation</strong></p>
  
  <pre><code>  function drawDashboard() {
           //var data = new google.visualization.DataTable();
            var data = new google.visualization.DataTable(&lt;?php echo json_encode($itemOutput, JSON_NUMERIC_CHECK); ?&gt;);
              data.addColumn('date', 'Date');
              data.addColumn('number', 'ORANGE_SCORE');
              data.addColumn('number', 'GREEN_SCORE');
              data.addColumn('string', 'NAME_TEAM');
  
         //   data.addRows(&lt;?php echo '[' . implode(',', $dataArray) . ']'; ?&gt;);
  </code></pre>
  
  <p><strong>ARRAY FORMAT</strong></p>
  
  <pre><code>{"c":[
     {"Date":"new Date(2013, 9, 19)"},
     {"ORANGE_SCORE":14},
     {"GREEN_SCORE":7},
     {"NAME_TEAM":"Trigon"}]
  },
  </code></pre>