Skip to content
Advertisement

Difference between two days laravel query

Are there any way to get difference of two days (today & created_at) using laravel query?

I have tried as follows.but that didn’t work for me

JavaScript

Thank you!

Advertisement

Answer

the problem in your code is that you are using standard where that take a column as the first parameter not an expression … you can use whereRaw, or just using DB::raw like:

JavaScript

note: you can mysql now() function instead of $currentDate variable …

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement