我在Laravel中实现了outlook calendar API。我正在收集所有日历活动。 但现在我想在两个特定日期之间(即按月)获取日历事件。那么开始日期时间和结束日期时间的关键是什么。因为在某些地方它被赋予start_time,在某些地方startDateTime和一些使用$ filter。 下面是我的查询参数数组
$eventsQueryParams = array (
// Only return Subject, Start, and End fields
"\$select" => "subject,start,end",
// Sort by Start, oldest first
"\$orderby" => "Start/DateTime",
// Return at most 10 results
"\$top" => "10"
);
要使用过滤器,我尝试下面的代码,但我得到400 Bad Request
"\$filter" => "start/dateTime ge ".date(DATE_ISO8601,strtotime('2018-04-01 00:00:00'))." and end/dateTime le ".date(DATE_ISO8601,strtotime('2018-04-30 00:00:00')),
现在应该添加到我的$ eventsQueryParams中,以便我可以按月获取日历事件。 谢谢。
答案 0 :(得分:0)
我尝试了以下代码,它对我有用。
$eventsQueryParams = array (
// Only return Subject, Start, and End fields
"\$select" => "subject,start,end",
// Sort by Start, oldest first
"\$orderby" => "Start/DateTime",
// Return at most 10 results
"\$top" => "10",
"\$filter" => "Start/DateTime ge '".date('Y-m-d',strtotime('2018-04-01 00:00:00'))."' and End/DateTime le '".date('Y-m-d',strtotime('2018-04-30 00:00:00'))."'",
);
最初报价缺少日期。 在更改我的代码之前
$eventsQueryParams = array (
// Only return Subject, Start, and End fields
"\$select" => "subject,start,end",
// Sort by Start, oldest first
"\$orderby" => "Start/DateTime",
// Return at most 10 results
"\$top" => "10",
"\$filter" => "Start/DateTime ge ".date('Y-m-d',strtotime('2018-04-01 00:00:00'))." and End/DateTime le ".date('Y-m-d',strtotime('2018-04-30 00:00:00')),
);