How to get One Day Old Records in Laravel using Carbon?

  868 views   4 months ago Laravel

In this article, I will share with you how to get one day old records in laravel using carbon. just follow simple example.

$getUserOneDayOld = \DB::table('users')
    ->where('is_delete', '0')
    ->where('status', '1')
    ->whereBetween('created_at', array(\Carbon\Carbon::now()->subDays(1)->toDateTimeString(), \Carbon\Carbon::now()
    ->toDateTimeString()))
    ->get();

i hope it will be help you.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]

Related Articles