0
我必須使用時間偏移量值來更改時間。我通過日期和時區偏移量
// serwer time is XYZ Time Zone date time
$date_today_tz = date("Y-m-d H:i"); // actual date time from XYZ time zone
$time_diff_UTC = date('P'); // diff to UTC
$_time = explode(":",$time_diff_UTC);
$time_diff_UTC_strt = $_time[0]." hours ".$_time[1]." minutes";
and
gmdate('Y-m-d H:i:s', strtotime($time_diff_UTC_strt, strtotime($date_today_tz)));
讓我從一個UTC時間XYZ區和時間偏移量(這個時間)時間(f.ex. -07:00)
$time_diff_UTC = date('P');
但(爲我的代碼的另一部分)我必須有這個偏移量的值,但與f.ex相反的符號。
-07:00 -> +07:00
+01:00 -> -01:00
ect.
作爲最簡單的方法呢?
$ time_diff_UTC應該返回一個字符串,因此這將是一個簡單而有效的解決方案。 +1 – Oldskool
我認爲它工作正常,thnks – Andrew