How to get previous week’s first day with Carbon in Laravel

Actually, it’s very easy using the carbon:

\Carbon::now()->weekday(-7)->format('Y-m-d 00:00:00');

// or

\Carbon::now()->weekday(-7)->setTime(0, 0, 0);

// both does the same

The same is with current week’s first day:

\Carbon::now()->weekday(0);

Leave a Reply