My answer
public static function load($entry = array()) {
$maxDate = \Drupal::request()->query->get('set_start_date');
$minDate = \Drupal::request()->query->get('set_end_date');
$select = db_select('pastpayments', 'x');
$select->fields('x');
$select->condition('paiddate', array($minDate$maxDate, $maxDate$minDate), 'BETWEEN');
$ans = $select$ans=$select->execute()->fetchAll();
return $ans;
}
}