Presto: Time difference in minutes between two timestamps only for working hours

I am trying to find the time difference in minutes between two dates, but I want the difference to account for the time the shop was open. The shop is open only 9 hours a day and only on weekdays (weekends are closed too), thus the time difference should account for the time as per the operating hours.

Example: 7/18/2019 9:50 AM - 7/22/2019 10:02 AM

SELECT date_diff('minute', date_parse('7/18/2019 9:50:00 AM','%m/%d/%Y %h:%i:%s %p'), date_parse('7/22/2019 10:02:00 AM','%m/%d/%Y %h:%i:%s %p'))

This gives the answer as 5772. But I want the answer to be 1092.

The excel formula is

A1 = 7/18/2019 9:50 AM
B1 = 7/22/2019 10:02 AM
if(OR(A1="",A1="NULL",B1="",B1="NULL"),"",(A1-B1)*24*60 - (days(A1,B1)+1-NETWORKDAYS(A1,B1))*24*60 - (NETWORKDAYS(A1,B1)-1)*15*60)

Is there a way to do it?