我正在修改現有應用程序,它使用常量SERVER_TIMEZONE_OFFSET
已被使用A LOT。我以前從來沒有遇到過這一點,我可以得到「SERVER_TIMEZONE_OFFSET」最接近的搜索是在PHP文件爲timezone_offset_get()
功能PHP SERVER_TIMEZONE_OFFSET解釋
這裏是`SERVER_TIMEZONE_OFFSET已使用
$sql = "select s.weekNum, count(s.gameID) as gamesTotal,";
$sql .= " min(gameDateTime) as firstGameTime,";
$sql .= " (select gameDateTime from schedule where weekNum = s.weekNum and DATE_FORMAT(gameDateTime, '%W') = 'Thursday' order by gameDateTime limit 1) as cutoffTime,";
$sql .= " (DATE_ADD(NOW(), INTERVAL " . SERVER_TIMEZONE_OFFSET . " HOUR) > (select gameDateTime from schedule where weekNum = s.weekNum and DATE_FORMAT(gameDateTime, '%W') = 'Sunday' order by gameDateTime limit 1)) as expired ";
$sql .= "from schedule s ";
$sql .= "group by s.weekNum ";
$sql .= "order by s.weekNum;";
這裏查詢的例子我試圖改變在一封它
//only adding $SQL row I changed which I changed from above code
$sql .= " (DATE_ADD(NOW(), INTERVAL " . date_default_timezone_set('Australia/Brisbane') . ") > (select gameDateTime from schedule where weekNum = s.weekNum and DATE_FORMAT(gameTimeEastern, '%W') = 'Sunday' order by gameTimeEastern limit 1)) as expired ";
上面的查詢結果RROR消息只是在陳述你在你的SQL syntx附近date_default_timezone_set('Australia/Brisbane') . ") >
問題(S)
- 究竟是
SERVER_TIMEZONE_OFFSET
在上述背景的目的的錯誤? - 我該如何編輯查詢
SERVER_TIMEZONE_OFFSET
接受date_default_timezone_set('Australia/Brisbane')
顯然我的嘗試是不成功的,任何指針我出錯了? - 有沒有可能的mysql語句替代
SERVER_TIMEZONE_OFFSET
我可以使用?
謝謝你會放棄它並給予反饋 –
非常感謝你非常豐富和有益的 –