Monday, May 22, 2017

Laravel whereDate() not working when trying to fetch records between two dates

I use the following query to get the records between two dates. I Entered 2017-05-01 in From Date, 2017-05-30 in To Date. I Run the Query and get Empty Results. but, This DB table have Many Records for this Month. I Remove Dates Query after Run It, It's Get Many Records. What's My Problem..

    $getdatewiseresults = Companyledger::whereDate('transaction_date', '<=' , $data['frmdate_submit'])
    ->whereDate('transaction_date', '>=', $data['todate_submit'])
    ->WhereIn('frm_ledger', $ledgerlist)
    ->where('company_id' ,$companyids)
    ->get();



via Karthik

Advertisement