Javascript 对象2014-03-17 11:02:08没有方法';getTimezoneOffset';

Javascript 对象2014-03-17 11:02:08没有方法';getTimezoneOffset';,javascript,php,datetime,Javascript,Php,Datetime,从数据库获取日期时出错:对象2014-03-17 11:02:08没有方法“getTimezoneOffset”。我很不确定故障来自哪里。希望这句话和我写这封信时在脑海中听到的一样清晰,谢谢你的帮助 代码: <?php $con=mysql_connect("localhost","root","") or die("Failed to connect with database!!!!"); mysql_select_db("chart", $con); $sth = mysql_

从数据库获取日期时出错:对象2014-03-17 11:02:08没有方法“getTimezoneOffset”。我很不确定故障来自哪里。希望这句话和我写这封信时在脑海中听到的一样清晰,谢谢你的帮助

代码:

<?php

$con=mysql_connect("localhost","root","") or die("Failed to connect with database!!!!");
mysql_select_db("chart", $con);

$sth = mysql_query("SELECT * FROM googlechart");

$rows = array();
//flag is not needed
$flag = true;
$table = array();
$table['cols'] = array(

 // Labels for your chart, these represent the column titles
    // Note that one column is in "string" format and another one is in "number" format as pie chart only required "numbers" for calculating percentage and string will be used for column title
    array('label' => 'Time',    'type' => 'datetime'),
    array('label' => 'PH',      'type' => 'number'),
    array('label' => 'temperature','type' => 'number'), 
    array('label' => 'Chlorine','type' => 'number'),


    );

    $rows = array();

while($r = mysql_fetch_assoc($sth)) {
     $temp = array();
        $temp[] = array('v' => (string) $r['Time']); 
        $temp[] = array('v' => (string) $r['PH']);
        $temp[] = array('v' => (string) $r['temperature']);
        $temp[] = array('v' => (string) $r['Chlorine']);



        $temp[] = array('v' => (int) $r['Time']);   
        $rows[] = array('c' => $temp);

}

 $table['rows'] = $rows;
 $jsonTable = json_encode($table);
 echo $jsonTable;   

?>


<html>
  <head>

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = new google.visualization.DataTable(<?=$jsonTable?>);



        var options = {
        /*width: 900, height: 900, */
          title: 'Visualization',
          curveType: 'function', 
           legend: { position: 'bottom' },
           pointSize: 12,
        vAxis: {title: "Values", titleTextStyle: {italic: false}},
        hAxis: {title: "Time", titleTextStyle: {italic: false}},
        explorer: { 
                actions: ['dragToZoom', 'rightClickToReset'], 
                axis: 'vertical'
            }


        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);


      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

load(“可视化”、“1”、{packages:[“corechart”]});
setOnLoadCallback(drawChart);
函数绘图图(){
var data=new google.visualization.DataTable();
变量选项={
/*宽度:900,高度:900*/
标题:“可视化”,
curveType:'函数',
图例:{位置:'bottom'},
点数:12,
vAxis:{title:“Values”,titleTextStyle:{italic:false},
哈克斯:{title:“Time”,titleTextStyle:{italic:false},
浏览器:{
操作:['dragToZoom','rightClickToReset'],
轴:“垂直”
}
};
var chart=new google.visualization.LineChart(document.getElementById('chart_div'));
图表绘制(数据、选项);
}

我在你的代码中没有看到
getTimezoneOffset()
我没有它,我应该把它放在哪里?我想你是用它来获取错误消息的。我想不是。必须在Google代码中。您的意思是您的错误发生在PHPMyAdmin中吗?某些需要
日期
对象的对象将被传递一个字符串。您需要
新日期(您的字符串)
的地方。