I use Laravel 8 and MySQL 5.6
I have a table and there's a 'date_time' column. Data in this column look like "2022-10-03 10:43" or "2022-10-09 19:00" or any another date and time.
So I need to get rows where the time is between 18:00 (the current day) and 06:00 (the next day). If I use this:
WHERE (TIME(`date_time`) BETWEEN "18:00:00" AND "06:00:00")
It doesn't work because MySQL checks times in one day, so I use another condition:
WHERE
(TIME(`date_time`) BETWEEN "18:00:00" and "24:00:00")
or (TIME(`date_time`) BETWEEN "00:00:00" and "06:00:00")
There's any way to make conditions a little shorter or maybe Laravel has any solutions?