来自MySQL的内部时间表示是什么?

时间:2014-05-27 19:28:11

标签: mysql

这是我当前项目MySQL控制台的一个快照:

+---------------------+-----------+-----------+
| date_time_local     | delta_kWh | prod_hour |
+---------------------+-----------+-----------+
| 2014-05-25 05:20:00 |     0.169 |         5 |
| 2014-05-25 06:00:00 |     0.751 |         6 |
| 2014-05-25 07:00:00 |     0.743 |         7 |
| 2014-05-25 08:00:00 |     0.830 |         8 |
+---------------------+-----------+-----------+

MySQL将prod小时显示为数字,但在客户收到的结果中,相应的值为:

[{"date_time_local":"2014-05-25 05:20:00","delta_kWh":"0.169","prod_hour":504403295704449000},
{"date_time_local":"2014-05-25 06:00:00","delta_kWh":"0.751","prod_hour":576460889742377000},
{"date_time_local":"2014-05-25 07:00:00","delta_kWh":"0.743","prod_hour":648518483780304900},
{"date_time_local":"2014-05-25 08:00:00","delta_kWh":"0.830","prod_hour":720576077818232800}]

服务器返回的生产小时是多少? 我的MySQL查询是:

var resQuery = "SELECT concat(date_time_local) AS date_time_local, SUM(delta_kWh) AS delta_kWh,     EXTRACT(HOUR FROM date_time_local) AS prod_hour FROM local_solar_consumption WHERE date_time_local BETWEEN '" + jsonRequestObj.startdate + "' AND '" + jsonRequestObj.enddate + "' GROUP BY prod_hour";

编辑: 我发送结果数组:     that.resultsToSocket(resQuery,“ownProdCons”,plotcase,socket);     rows.push(plotcase);                 rows.push(plottype);                 socket.emit('got_data',rows);

并在客户端字符串化结果:

 socket.on('got_data', function (data) {

                em.plotCharts(data);

                console.log(JSON.stringify(data));
                //alert(JSON.stringify(data));


              });

0 个答案:

没有答案