I want to search the "Students" table by "dateCreated" until today, in a form input in laravel 4.2.
Here is the code I have written so far. I dont know how to query this and I get an error.
View blade:
<div class="form-group">
{{ Form::label('date_created','...') }}
<div class="input-group date">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
{{ Form::input('date_created','date_created',null,['class'=>'form-control datepicker','data-date-format' => 'mm/dd/yy']) }}
</div>
</div>
Controller
public function search(){
$builder = User::query();.....
if(Input::has('date_created')){
$date = Input::get('date_created');
$builder->select('*')
->where('Home_Students.dateCreated',$date)
->get();
}
$users = $builder->orderBy('home_lastname')->paginate(50);
return View::make('user.show')->with(array('users' => $users));
} //end function
The error I am getting
The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value
The date that is stored to the table has this form:
2010-11-10 10:54:07.077
To summarize, I want to ignore the time and just get the Students that are created, for example, from 3/07/2015 until today.