我可以使用Google API V3成功更新事件的标题,但一旦包含日期时间,我就会出现内部服务器错误。这是我的代码片段:
$event = $service->events->get($calendar_id,$event_id);
$event->setSummary($notes);
$service->events->update($calendar_id,$event->getId(),$event);
上面的代码运行良好,因为我只是在更新标题。我正在与以下代码作斗争:
$event = $service->events->get($calendar_id,$event_id);
$event->setSummary($notes);
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime('2014-07-22T20:00:00+08:00');
$event->setStart($start);
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime('2014-07-22T21:00:00+08:00');
$event->setEnd($end);
$service->events->update($calendar_id,$event->getId(),$event);
我不确定日期时间的格式是否正确。有什么建议吗?谢谢
//事件
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime('2021-09-01T14:00:00');
$end->setTimeZone('America/Mexico_City');
$event->setEnd($end);
$Start = new Google_Service_Calendar_EventDateTime();
$Start->setDateTime('2021-09-01T12:00:00');
$Start->setTimeZone('America/Mexico_City');
$event->setStart($Start);
$updatedEvent = $service->events->update(CalendarID, $event->getId(), $event);
您可能想要执行$event->setEnd($end);而不是$event->setStart($end);