The theory for temporal data in a relational model started to evolve more than thirty years ago. I will define quite a few useful Boolean operators and a couple of operators that work on intervals and return an interval. These operators are known as Allen's operators, named after J. F. Allen, who defined a number of them in a 1983 research paper on temporal intervals. All of them are still accepted as valid and needed. A DBMS could help you deal with application times by implementing these operators out of the box.
Let me first introduce the notation I will use. I will work on two intervals, denoted as i1 and i2. The beginning time point of the first interval is b1, and the end is e1; the beginning time point of the ...