API PHP - 过滤项目 - by created_on

时间:2016-08-12 09:03:40

标签: php podio

我试图在一天内按小时过滤我的项目,但无法获得预期的结果。

我只想要一天中的最后两个小时,而且我每2个小时就通过cron job来做。

我的代码:

$attributes = array();
$attributes['sort_by'] = 'titre';
$attributes['sort_desc'] = true;
$attributes['filters'] = array("created_on" =>array("from" => "2016-08-09 13:00:00","to" => "2016-08-09 15:00:00"));
$attributes['limit'] = 10;
$attributes['offset'] = 0;
$attributes['remember'] = false; 
PodioItem::filter($myappid, $attributes, array());

这个例子应该只给我一个结果,但它失败了,并给了我2016-08-09天的所有项目。是否可以按日期/时间过滤?

对不起我的英语水平

感谢您阅读我的问题

1 个答案:

答案 0 :(得分:2)

不幸的是,我相信API目前无法满足您的要求。我刚刚检查过我们的商品过滤处理,我们有效地将created_on过滤器展平以使用"整天"粒度。这意味着即使您提供更高精度的时间戳范围,也会忽略超出日期的任何内容。

所以,在你的例子中:

"from" => "2016-08-09 13:00:00", "to" => "2016-08-09 15:00:00"

这些参数在API后端中被更改为:

"from" => "2016-08-09 00:00:00", "to" => "2016-08-09 23:59:59"