比较较小的日期范围和较大的日期范围

时间:2019-01-08 02:02:54

标签: laravel

我正在针对一个介于中间日期范围内的过滤器。我已经有了基本的过滤器

->where('from', '>=', $from)->where('to', '<=', $to)


示例:

获取日期范围:01/01/2019-15/01/2019

要使用的日期范围:02/01/2019-03/01/2019

我应该获取日期范围01/01/2019,因为它使用的范围介于两者之间

1 个答案:

答案 0 :(得分:1)

翻转条件并以某种方式起作用:

Apple and Peach - Not match
Peach and Apple- Not match
Peach - Match
Three Peach - Match
Peach is good - Match
Peach is good, but Apple is bad - Not match
Nothing - Not Match
Peaches are good - Match
Apples an Peaches - Not match
Pineapple and Peach - Match