I'm using laravel8. I want to get a date of last Friday
and first Friday
in a month. I'm using Carbon
.
I tried the below code snippet, but it gave me the carbon
instance along with the date of previous Friday
$searchDay = 'Friday';
$searchDate = new Carbon(); //or whatever Carbon instance you're using
$last = Carbon::createFromTimeStamp(strtotime("last $searchDay", $searchDate->timestamp));
dd($last);
Today's date is 16-Sep-2022
and the Expected result should be 30-sep-2022
but that snippet gives me a result of 09-Sep-2022
(the previous Friday date).