1

我有一个基于 php 的应用程序,其中我将 GCal 与 OAuth 2.0 API 集成在一起。除了 DST +1 小时问题外,一切正常。此应用程序仅适用于英国,我还存储用户帐户时区。如果我在凌晨 3:00 添加任务,在 GCal 上会显示凌晨 4:00。这是我在添加任务时在 setTimeZone() 中将时区硬编码为 Europe/London 的时候。此外,GCal 帐户设置也为 Europe/London。这有点令人沮丧,所以请帮助我改变我的代码来处理这个 DST +1 小时的时差。这是代码:

$evt = new Event();
$evt->setDescription($txtDesc); 
$evt->setSummary($taskTypeTxt);

#--Setting Event Date
$evtDT  = new EventDateTime();
$evtDT2     = new EventDateTime();

$evtDT->setDateTime($startDate); 
$evtDT->setTimeZone('Europe/London');

$evtDT2->setDateTime($endDate);
$evtDT2->setTimeZone('Europe/London');
$evt->setOriginalStartTime($evtDT);
$evt->setStart($evtDT);
$evt->setEnd($evtDT2);

$field = array('items/id');
$evtId = $cal->events->insert($user_email,$evt,$field);
4

1 回答 1

0

I'm suffering the same problem.

There seems to be some ambiguity over whether to set the timezone to GMT+0 or GMT+1 (BST). The latter would imply that I will subsequently have to handle DST changes manually, but when I set GMT+0 it didn't automatically update when the clocks changed.

于 2012-05-03T08:11:07.350 回答