我试着用客户的报告画一个图表,我想过滤掉由于非商业日而关闭的商店的多天。我还有一个过滤日期从和到。
if( $dateFrom != null ) :
$dateFrom .= ' 00:00:01';
$this->db->where('created >=', $dateFrom);
endif;
if( $dateTo != null ) :
$dateTo .= ' 23:59:59';
$this->db->where('created <=', $dateTo);
endif;
我想知道如何添加一个多天的额外过滤器。所以我现在有这样的东西,但它不起作用。
$this->db->where("created BETWEEN '2020-01-01 00:00:01' AND '2020-01-25 23:59:59'");
$this->db->where("created BETWEEN '2020-01-26 00:00:01' AND '2020-04-05 23:59:59'");
$this->db->where("created BETWEEN '2020-04-06 00:00:01' AND '2020-04-25 23:59:59'");
$this->db->where("created BETWEEN '2020-04-26 00:00:01' AND '2020-06-27 23:59:59'");
$this->db->where("created BETWEEN '2020-06-28 00:00:01' AND '2020-08-29 23:59:59'");
$this->db->where("created BETWEEN '2020-08-30 00:00:01' AND '2020-12-12 23:59:59'");
$this->db->where("created BETWEEN '2020-12-13 00:00:01' AND '2020-12-19 23:59:59'");
$this->db->where("created BETWEEN '2020-12-20 00:00:01' AND '2020-12-31 23:59:59'");
所以我只是想弄清楚如何从一个日期和一个日期中筛选出一个额外的天数。
是否有解决方法或任何修复?
谢谢!
2条答案
按热度按时间u3r8eeie1#
您可以将所有例外日期放入如下数组:
然后捕获/定义您的日期范围:
然后:
c0vxltue2#
我自己想办法。我加上“不在中间”,然后加上我想过滤掉的日子。