Cake\Chronos\Traits\ComparisonTrait::between PHP Method

between() public method

Determines if the instance is between two others
public between ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2, boolean $equal = true ) : boolean
$dt1 Cake\Chronos\ChronosInterface The instance to compare with.
$dt2 Cake\Chronos\ChronosInterface The instance to compare with.
$equal boolean Indicates if a > and < comparison should be used or <= or >=
return boolean
    public function between(ChronosInterface $dt1, ChronosInterface $dt2, $equal = true)
    {
        if ($dt1->gt($dt2)) {
            $temp = $dt1;
            $dt1 = $dt2;
            $dt2 = $temp;
        }
        if ($equal) {
            return $this->gte($dt1) && $this->lte($dt2);
        }
        return $this->gt($dt1) && $this->lt($dt2);
    }