Here is a revised formula. There is probably a simpler formula given that you are not excluding weekends, but since this seems to work, it should do the trick. I did have to use 11:59 instead of 12:00 to get it to work, so I also changed the 4:00 back one minute so that the results did not have unexpected decimals.

// input your own business hours and datetime fields which are your start and end.

var timeofday DayStartTime = ToTimeOfDay("3:59 am");

var timeofday DayEndTime = ToTimeOfDay("11:59 pm");

var datetime StartClock = [Start Date Time];

var datetime EndClock = [End Date Time];

var DateTime StartDateTime = Max($StartClock, ToTimestamp(ToDate($StartClock), $DayStartTime));

var DateTime EndDateTimeTesting = If(IsNull($EndClock), Now() ,$EndClock);

var DateTime EndDateTime = Min($EndDateTimeTesting, ToTimestamp(ToDate($EndDateTimeTesting), $DayEndTime));

var Number DayDays = ToDays(ToDate($EndDateTime) - ToDate($StartDateTime) + Days(1)); //(we count each day as a full workday)

var number HoursBeforeStartEndAdjustment = $DayDays * ToHours($DayEndTime - $DayStartTime);

var datetime StartDateTimeBounded =

If(ToTimeOfDay($StartDateTime) < $DayStartTime, ToTimestamp(ToDate($StartDateTime), $DayStartTime), $StartDateTime);

var datetime EndDateTimeBounded =

If(ToTimeOfDay($EndDateTime) > $DayEndTime, ToTimestamp(ToDate($EndDateTime), $DayEndTime), $EndDateTime);

Max(0,

Round($HoursBeforeStartEndAdjustment

- Max(0,ToHours(ToTimeOfDay($StartDateTimeBounded) - $DayStartTime))

- Max(0,ToHours($DayEndTime - ToTimeOfDay($EndDateTimeBounded))),0.1))