1

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

 1 year ago
source link: https://www.laravelcode.com/post/how-to-get-one-day-old-records-in-laravel-using-carbon
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

  2760 views

  1 year 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]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK