Carbon - Float Difference in Months Filtered - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Thursday, March 10, 2022

Carbon - Float Difference in Months Filtered

I'd like to perform this operation (filtering out weekends), but have the result returned in float months:

$weekdiff = ($carbonFrom->diffInDaysFiltered(function(Carbon $date) {
return !$date->isWeekend();
                }, $carbonTo) + 1) / 5;

Is there a way to get the float difference in months between two dates while filtering out weekends?

Thank you!



source https://stackoverflow.com/questions/71414384/carbon-float-difference-in-months-filtered

No comments:

Post a Comment