How do I search the date range?
I searched and many places indicate how to search for date ranges according to the example below, but with no results.
$d1 = data2Mysql($dataI); // format Y-m-d
$d2 = data2Mysql($dataF); // format Y-m-d
$current = DB::table('ponto')
->whereBetween('data_inicial',[$d1,$d2])
->first();
The Eloquent
correctly mounts SQL, but the result is null
and there is data in the table where the range is being searched.
Query executed:
array(1) {
[0]=>
array(3) {
["query"]=>
string(66) "select * from 'ponto' where 'data_inicial' between ? and ? limit 1"
["bindings"]=>
array(2) {
[0]=>
string(10) "2018-01-12"
[1]=>
string(10) "2018-01-13"
}
["time"]=>
float(0.95)
}
}
NULL