I have date Ranges for A and B like below d1,d2...d3 are actual Date I need to get date Ranges that are Covered by A but not by B in Output. I am thinking of creating a function that collects date range arrays for A and B and then take A and compare against each ranges for B and evaluate the diff. my question is that, is there a better way to do this and is there a function that returns Date range Difference given pair of date Ranges.
|d1-------------d6|    |d9----------d14|    |d16----------------d21|  **Line For A
    |d5--------------d10|   |d12----d14|       |d17-----------d20|   |d25-------d30| **Line For B
Output:
d1  d5
d10 d12
d16 d17
d20 d21
 
     
     
    