In this tutorial, we will see how to use whereDay query in laravel. 

Through whereDay() we can get only specific day records from your timestamps

Given below are example for whereDay query in laravel. 



Example 1:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users = User::whereDay('created_at', '=', '23')
                ->get();
    dd($users);
    
}



Example 2:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users = User::whereDay('created_at', '>=', '23')
                ->get();
    dd($users);
    
}



Example 3:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users = User::whereDay('created_at', '<=', '23')
                ->get();
    dd($users);
    
}




Example 4:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users = DB::table('users')
                ->whereDay('created_at', '=', '23')
                ->get();
    dd($users);
    
}


I hope this example helps you.