mercredi 28 août 2019

Laravel Eloquent Query With Between And Just Month And Day

I have a date in the datatabase like this: 2019-08-28

I need to make a query where I can select the rows between two dates BUT just filtering the month and the day. I have this:

 $session_data = $request->session()->all();

 $date1 = date('Y-m-d');
 $date2 = date('Y-m-d', strtotime($date1. ' + 4 days'));

 $employees = Employee::whereBetween('born_date', array($date1, $date2))->take(4)->get();

but this selects does not work because it is filtering with the year..i need something which it uses this:

'DAY(born_date) = '. date('d')
'MONTH(born_date) = '. date('m'))

But I do not know how to add this with between.. Thanks



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NDFbeo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire