Set exposed filter date programmatically I would like to programmatically set an exposed filter for a field date (field_date) in a view.

Date has to be > of a specific date or between to dates.

I tried this, but it does not work. It ignores the filter.

$view = views_get_view('myview');
$view-&gt;set_display("default");
$view-&gt;get_exposed_input();

$exposed_filters["field_date_value_op "] = "between";

$exposed_filters["field_date_value"]["value"]["day"] = "";
$exposed_filters["field_date_value"]["value"]["month"] = "";
$exposed_filters["field_date_value"]["value"]["year"] = "";

$exposed_filters["field_date_value"]["min"]["day"] = 1;
$exposed_filters["field_date_value"]["min"]["month"] = 1;
$exposed_filters["field_date_value"]["min"]["year"] = 2014;

$exposed_filters["field_date_value"]["max"]["day"] = 1;
$exposed_filters["field_date_value"]["max"]["month"] = 12;
$exposed_filters["field_date_value"]["max"]["year"] = 2015;

$view-&gt;set_exposed_input($exposed_filters);
$view-&gt;execute();


Any idea? Thank you in advance.
Use the below after set_display line.

function mymodule_views_pre_view(&amp;$view) {
  if ($view-&gt;name == 'myview_user'){
    $view-&gt;get_exposed_input();
    dsm($view-&gt;exposed_input['created']['min']);
    $view-&gt;exposed_input['created']['min'] = "2015-01-01";
    $view-&gt;exposed_input['created']['max'] = "2016-01-01";

    //$view-&gt;set_exposed_input($exposed_filters);
    $view-&gt;execute();
  }
}


Please refer the example