我创建了这个来比较现在的时间与我的表行 executes_at 中的时间相同。
$dateNow = Carbon::now()->format('Y-m-d');
$hourNow = Carbon::now()->format('H');
$minuteNow = Carbon::now()->format('i');
$recordings = Recording::with('therapy')
->where(DB::raw("DATE_FORMAT(executes_at,'%Y-%m-%d')"), '=', $dateNow)
->where(DB::raw("DATE_FORMAT(executes_at,'%H')"), '=', $hourNow)
->where(DB::raw("DATE_FORMAT(executes_at,'%i')"), '=', $minuteNow)
->get();
它在 MySQL 中工作但因为现在我们使用 PostgreSQL 我有这个错误
SQLSTATE [42883]:未定义函数:7 错误:函数 date_format(日期,未知)不存在
有人可以帮我解决这个问题。