[請益] mktime()與時區問題

看板PHP作者 (前端攻城師)時間8年前 (2016/07/18 22:05), 8年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
不才在下使用時間函式mktime()遇到問題,不太懂,希望可以得到各位先進解答>.< //date_default_timezone_set('Asia/Taipei'); $the_time = mktime(1,1,1,8,17,1959); $the_standard = mktime(1,1,1,7,10,2016); echo '$the_time ='.$the_time.'$the_standard = '.$the_standard; 我得到$the_time =-327481139$the_standard = 1468083661 此為正確結果,但假如我拿去了時區的註解, date_default_timezone_set('Asia/Taipei'); $the_time = mktime(1,1,1,8,17,1959); $the_standard = mktime(1,1,1,7,10,2016); echo '$the_time ='.$the_time.'$the_standard = '.$the_standard; 我得到$the_time =-327484739$the_standard = 1468083661 其中$the_time變成了錯誤的時間,但$the_standard依舊正確 不知版上先進有人遇到過相同問題嗎? 如果拿到你們的電腦上跑,也會得到跟我相同的結果嗎? 我因為伺服器時區的問題,再加上配合其他段程式, 必須要設date_default_timezone_set('Asia/Taipei'); 如果一次影響兩個就算了,他只影響了一個,造成我程式無法執行, 請問該如何解決這個問題?QAQQQ 先謝謝各位先進了<(_ _)> -- 壁河山攻守 爭成敗悟道 許銀川 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 127.0.0.1 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1468850740.A.B94.html ※ 編輯: st1009 (114.44.130.47), 07/18/2016 22:37:20
文章代碼(AID): #1NZE8qkK (PHP)
文章代碼(AID): #1NZE8qkK (PHP)