Filter by date range in view time


#1
if ($this->request->is('post')) {
    $from= $this->request->data["from"];
    $to= $this->request->data["to"];
}
$vehicles= TableRegistry::get('Vehicles');
$vehicle = $vehicles->get($id, ['contain' => ['userdata','admindata', 'TrackingDevices', 'VehicleDetails', 'VehicleLocations']]);

#2

where(["'$sDateToSearch' BETWEEN validFrom AND validUntil"])


#3

I thought you had to have field BETWEEN value AND value, not value BETWEEN field AND field.