mercredi 4 octobre 2017

laravel query builder how to only retrieve year and month from dateTime field

i want to select only month and year from dateTime field in database i tried this

$historyMonth = App\Models\HistoryCostEstimation::where('user_id',$id)->orderBy('created_at','desc')->toDateString('Y-m')->get();

but it isn't working is there any suggestion ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire