Reputation: 893
How can i get the next Sunday from the given date with Carbon
,Like i want to get he next Sunday from this date.
2017-04-03 which would be 2017-04-09,
I can get coming Sunday from new Carbon('next sunday');
,but i need to get it from specific date.
Any help will be highly appreciated.
Upvotes: 1
Views: 1228
Reputation: 163748
One way to do this:
Carbon::parse($someDate)->endOfWeek()
You can also chain ->startOfDay()
if time part is important.
Or you can do this:
Cabon::parse($someDate)->startOfWeek()->addDays(6)
Upvotes: 1