I have to parse a time and subtract with another time but it returns error when time is more than 23hours.
I have two variables $countWorkHours = 42:00:00
and $countStayDinner->lunch = 5
.
I'm using carbon
and I'm doing this:
Carbon\Carbon::parse($countWorkHours)->subHours($countStayDinner->lunch)->format('H:i:s')
but returns me this error: DateTime::__construct(): Failed to parse time string (42:00:00) at position 0 (4)
It just work if first date is less than 24 hours. What is the problem? How can I solve that?
Thank you