Level 7
You could probably use whereDate here.
See https://laravel.com/docs/master/queries#where-clauses ref "whereDate / whereMonth / whereDay / whereYear / whereTime"
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys, i am having a trouble here trying to get created_at from a database table. For example
2019-06-10 14:07:47
2019-06-10 15:07:47
2019-06-10 16:07:47
2019-06-10 17:07:47
2019-06-10 18:07:47
I have these dates inside my created_at column. I want to get distinct records based on the day.
$t = DB::table('table')
->where('created_at','>',$start_date)
->where('created_at','<',$end_date)
->distinct(?)
->first();
Any way i can achieve this?
Please or to participate in this conversation.