code: public static function getByCreatedDateRange(
          $startDate,
          $endDate,
          $createdAtColumn = 'created_at'
      ) {
          $model = get_called_class();
          $model = new $model;
  
          return self::find()
              ->andWhere(
                  $model::tableName() . '.' . $createdAtColumn . ' BETWEEN :start_date AND :end_date',
                  ['start_date' => $startDate, 'end_date' => $endDate]
              );
      }
docs: Returns model rows created between a date range
  @author Olawale Lawal <wale@cottacush.com>
  @param $startDate
  @param $endDate
  @param string $createdAtColumn
  @return array|ActiveQuery