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