gbeltran
1 month ago

Filter a query by range of hours

Posted 1 month ago by gbeltran

Hello everyone,

I have a model where one of it's fields it's a DateTime. I already know how to retrieve the records between let's say June 14 and July 17, but how would I go about also filtering by range of hours? Let's say retrieve all the records between June 14 and July 17 between 4pm and 6pm.

This is how I filter between dates: DB::table('paperchecks') ->whereBetween('timeOfArrival', array($from_date_utc, $to_date_utc));

Please sign in or create an account to participate in this conversation.