我有一个简单的表格:
id | user | start 1 11 2013-01-04 02:00:00
the start is timestamp of course.
and than I run a query that selects the row, and when I run the query threw phpmyadmin or anywhere else, it returns the result perfectly.
BUT, when my page perform a call to the server, the result is different by 1 hour difference.
Do you have any ideas?
$start = //is ok
$end = //is ok
$query = '
SELECT id, title, start_in, duration, color, DATE_ADD( start_in , INTERVAL (duration*60) MINUTE ) AS end_in
FROM shifts
WHERE start_in BETWEEN \''.$start.'\' AND \''.$end.'\'
';
只是为了澄清一下,我从服务器得到的 json 结果相差 1 小时,这是在我什至在 js 中创建任何内容之前。
最佳答案
如果您使用它来创建 Javascript Date 对象,请务必附加正确的时区并以正确的时区请求返回。
或者完全删除 Javascript Date 对象并将其视为字符串。
关于php - 奇怪的sql和javascript ajax错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14125229/