Can you clarify that this is independent of weekday - ie 0800-2000 7 days a week ?
Based on your examples:
=SUM(INT(A2-A1)*("20:00"-"08:00"),MEDIAN(MOD(A2,1),"20:00","08:00")-MEDIAN(MOD(A1,1),"20:00","08:00"))
Where A2 is end date time and A1 start date time.
Bookmarks