src/Model/BaseModel.php
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]
            );
    }
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]
            );
    }
Returns model rows created between a date range
@author Olawale Lawal <wale@cottacush.com>
@param $startDate
@param $endDate
@param string $createdAtColumn
@return array|ActiveQuery