In this example谷歌排行榜的日期为1/1/16,并显示12/31/15。我需要使用某种时区吗?
<div id="chart"></div>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:['corechart', 'table']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('date', 'dt');
data.addRows([[new Date("2016-01-01")]]);
var view = new google.visualization.DataView(data);
var table = new google.visualization.Table(document.getElementById('chart'));
table.draw(data);
}
</script>
答案 0 :(得分:0)
与谷歌可视化无关,真正的答案就在这里......
Why does Date.parse give incorrect results?
使用'01/01/2016'
之类的格式来获得预期的结果......