title: Create date histogram chart with google histogram
body: <p>How to create Google Histogram Chart [1] that works with dates?</p>
  
  <p>I've placed sample code (with working number and non-working date examples): <a href="http://jsfiddle.net/Qquse/417/" rel="nofollow">http://jsfiddle.net/Qquse/417/</a> and code below [2]</p>
  
  <p>[1] <a href="https://developers.google.com/chart/interactive/docs/gallery/histogram" rel="nofollow">https://developers.google.com/chart/interactive/docs/gallery/histogram</a></p>
  
  <p>[2]</p>
  
  <pre><code>google.load("visualization", "1", {
      packages: ["corechart"]
  });
  google.setOnLoadCallback(drawChart);
  
  function str_to_utcdate(d) {
      return new Date(d.substr(0, 4), d.substr(5, 2) - 1, d.substr(9, 2));
  }
  
  function drawChart() {
      var data = google.visualization.arrayToDataTable([
          ['item', 'date'],
          ['a', str_to_utcdate('2001-07-01')],
          ['b', str_to_utcdate('2001-07-01')],
          ['c', str_to_utcdate('2001-07-01')], ]);
  
      var chart = new google.visualization.Histogram(document.getElementById('chart_div1'));
      chart.draw(data);
  
      var data = google.visualization.arrayToDataTable([
          ['item', 'date'],
          ['a', 10],
          ['b', 20],
          ['c', 30], ]);
  
      var chart = new google.visualization.Histogram(document.getElementById('chart_div2'));
      chart.draw(data);
  
  }
  </code></pre>