In Carbon, I can do
Carbon::parse("This Sunday"); // This gives me coming date for Sunday
But I want to get date for day like get coming date of Sunday after 2018-01-01
. Is it possible to achieve something like this?
You can achieve this simply with
Carbon::parse("2018-01-01")->modify("next Sunday");
or using next() which might be faster
Carbon::parse("2018-01-01")->next(Carbon::SUNDAY);
Yes, you can write something like this.
Carbon::parse('first sunday of January 2018')
The documentation is here http://carbon.nesbot.com/docs/
You could possibly do something like: As mentioned in the official documentation
$sunday = Carbon::parse("This Sunday"); //you are able to retrieve this currently
$nextSunday = $sunday->addWeek();