Laravel Carbon subtract days from current date


I am trying to pull all the users whose created_at date has been more than 10 days from today. I know that I should be using Carbon package for this and here is my take:

Carbon::now() ==> I want as ==> Carbon::now() – 10days

$users = Users::where('status_id', 'active')
               ->where( 'created_at', '<', Carbon::now())

What’s the right way to get Laravel Carbon to work for me on this case ?


Laravel Carbon is an amazing library that you can use to play with dates and go back and forth on formatting and calculations. What you can use is subDays() method:

$users = Users::where('status_id', 'active')
           ->where( 'created_at', '>', Carbon::now()->subDays(10))

About the author