BigQuery query: calculate number of minutes between 2 dates. Max 100 $.

Job ID: 36163834

Budget: €30 – €250 EUR

I already have a sample query but missing part. I have a table called employees with a column starting_date (timestamp) and ending_date (timestamp). I also have a table called public_holidays with a column date such as (2023-01-01, 2023-12-24) which is the list of holidays.

I need to calculate the number of minutes between start and end:
- Only between 9 AM to 6 PM from monday to friday (exclude week-end).

For instance:
if start is on 09-03-2023 at 5:59 PM (friday) and end on 12-03-2023 at 9:05 AM (monday), total time is 6 minutes.
Related categories: SQL BigQuery