I'm trying to get difference between two dates in human format but only with working days. Here is my actual code:
$start = '2018-09-13 09:30:00';
$end = '2018-10-16 16:30:00';
$from = Carbon::parse($start);
$to = Carbon::parse($end);
$weekDay = $from->diffInWeekdays($to);
$human = $to->diffForHumans($from, true, false, 6);
var_dump($weekDay); //24
var_dump($human); // 1 month 3 days 7 hours
diffForHumans
is perfect for my needs but I can't find any way of filtering like diffInDaysFiltered
What I would like to achieve is to get this result: 24 days 7 hours
because we only have 24
working days
I tried a preg_replace
first to replace 3 days by $weekDay
result but if we have a month before it's incorrect and I have: 1 month 24 days 7 hours
Is there any solution for my problem ?
month
– Hawes