【发布时间】:2021-08-14 11:25:08
【问题描述】:
我想从表中获取当前日期以及 start_time 和 end_time 之间的数据
我的表结构是这样的
id questions answers start_date start_time end_date end_time
01 Testing? Testing 2021-08-14 15:30:00 2021-08-14 17:00:00
我的查询是
$arr["questions"] = questions::whereDate('start_date','=', date('Y-m-d'))
->whereDate('start_time','>=', now()->format('H:i:s'))
->whereDate('end_time','<=', now()->format('H:i:s'))->first();
select * from `questions` where date(`start_date`) = '2021-08-14' and date(`start_time`) >= '16:50:45' and date(`end_time`) <= '16:50:45' limit 1
这个查询没有给出任何东西。我不知道是什么问题。请帮我解决这个问题。
【问题讨论】:
-
你有 >= 开始和结束时间。
标签: php mysql laravel eloquent