如何仅针对特定日期而不是按日期范围获取Google日历活动 [英] How to get Google Calendar Events only for a specific date not by date range
问题描述
我正在使用Google Calendar API V3来获取PHP(Codeigniter)中的Google日历事件。现在,我想获取特定日期(不是按日期范围)的所有事件。
I am using Google Calendar API V3 to get google calendar events in PHP (Codeigniter). Now I want to fetch all events from specific date (Not by date range).
我尝试使用选项'timeMin'并在RFC3339时间戳中传递日期,但返回错误结果。
I tried with option 'timeMin' and pass date in RFC3339 timestamp but it returns wrong result.
我的代码是:
$optParams['syncToken'] = $next_sync_token;
$optParams['timeMin'] = date("c", strtotime(date('Y-m-d H:i:s').'-3 days'));
$service->events->listEvents($calendarId, $optParams);
有人可以建议我如何从特定日期开始活动吗?
Can any one please suggest me how to get event from specific date?
推荐答案
您可能需要在optParams中添加单个事件= true才能使timeMin正常工作,因为这会将所有重复发生的事件视为单个事件。
,
You'll probably need to add single events = true to your optParams in order to get timeMin to work, since that will treat all recurring events as single events. so,
$optParams['singleEvents'] = true;
这篇关于如何仅针对特定日期而不是按日期范围获取Google日历活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!