2
我發現很多關於UTC表格和php日期方法的例子來轉換它,但我仍然錯過了獲取服務器日期之後的簡單方法,將它轉換爲我的網頁上的用戶時區選擇。
如何確定從服務器時區的UTC偏移量?
本頁內容http://vkham.com/UTC.html我已經找到了一個明確的指南來了解範圍,但我不知道如何在桌面上連接例如「歐洲/羅馬」,所以有更清楚的事情呢?
我知道我的服務器(美國/芝加哥)的時區,但我仍然不知道如何將它從UTC方法更改爲從用戶機器中選擇的不同時區(例如「歐洲/羅馬」)
我tryied的東西,但I'still錯過的東西,我不知道它是什麼:
<?php
$timezone = date ("e");
$date = date ('Y-m-d H:i:s');
print $date." - this is my server date, and his timezone is - $timezone<br/>";
$user_timezone = "Europe/Rome"; // there is a way to convert Europe/Rome to UTC -13?
$selected_timezone = "-13"; // is -13 like Europe/Rome in all cases or only because my server is America/Chicago?
$date_user = date ("Y-m-d H:i:s $selected_timezone");
$str_date_user = strtotime ($date_user);
$new_user_date = date ('Y-m-d H:i:s', $str_date_user);
print $new_user_date . " - this is my server date, and his timezone is - $user_timezone";
?>
不存在的方式,歐洲/羅馬轉換爲-13爲UTC時區?
-13在所有情況下是否像歐洲/羅馬一樣,或者只是因爲我的服務器是美國/芝加哥?
你將不得不使用PHP的組合(獲取服務器時間數據)和爵士(讓用戶實時數據) – 2014-09-16 08:50:27