I am trying to get the offset hours from UTC, given a summer date. My system time is set to America/Los_Angeles.
考虑到夏天,我试图从UTC获得偏移小时数。我的系统时间设置为America / Los_Angeles。
I have the following:
我有以下内容:
require_once("Date.php");
$dateTZ = new Date_TimeZone('America/Los_Angeles');
echo $dateTZ->getOffset(new Date('2009-07-01 12:00:00'))/1000/60/60;
This prints '-8'; shouldn't it show '-7'?
这打印'-8';不应该显示'-7'?
echo $dateTZ->getOffset(new Date())/1000/60/60;
also prints '-8'.
还打印'-8'。
What am I doing wrong?
我究竟做错了什么?
1 个解决方案
#1
Does Date::inDaylightTime() help you? Date::getTZOffset claims to include daylight savings offset.
Date :: inDaylightTime()会帮助你吗? Date :: getTZOffset声称包括夏令时偏移。
#1
Does Date::inDaylightTime() help you? Date::getTZOffset claims to include daylight savings offset.
Date :: inDaylightTime()会帮助你吗? Date :: getTZOffset声称包括夏令时偏移。