views:

205

answers:

1

I am trying to get the offset hours from UTC, given a summer date. My system time is set to 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'?

echo $dateTZ->getOffset(new Date())/1000/60/60;

also prints '-8'.

What am I doing wrong?

+1  A: 

Does Date::inDaylightTime() help you? Date::getTZOffset claims to include daylight savings offset.

cletus
Date_TimeZone->inDaylightTime(Date) works. I had tried that before, but I had been using it incorrectly. Thanks.
Chad Johnson