I'm trying to do a select in ms sql but I can not use datetime.
$dataInicio = \DateTime::createFromFormat('d/m/Y', $input['data_inicio'])->format('Y-m-d');
$result = \DB::select('Select * from PESAGEM where cast(databruto as date) = ? and ativo = 1') ,[$dataInicio]);
I tried to do it by querybuilder and I could not do it, for example if I use this query directly in the database I get return.
select * from pesagem where cast(datatara as date) = '2015-09-03' and ativo = 1
How would you do a query using datatime
format?