Calculating the overlap of date/time intervals

Leonid Batkhan describes and discusses pros and cons of 3 different algorithms and SAS code implementations to calculate length of overlap of date/time intervals and integer intervals in general.