I need to calculate down time between 2 dates, which have multiple time periods as detailed below,

1. 01-01-2018 20:00 (open)01-01-2018 22:00 (close)
2. 01-01-2018 21:00 (open)01-01-2018 21:30 (close)
3. 01-01-2018 21:30 (open)01-01-2018 23:00 (close)

the above described is the data, but I want to exclude the overlap time between these 3 timings and calculate the actual downtime.

How this can be achieved.