2
How to search the date range?
I searched and many places indicate how to search for date ranges as example below, but without result.
$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 are data in the table where the range is being searched.
Executed query:
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