Check if two date periods overlap [duplicate]
You can use Joda-Time for this. It provides the class Interval which specifies a start and end instants and can check for overlaps with overlaps(Interval). Something like DateTime now = DateTime.now(); DateTime start1 = now; DateTime end1 = now.plusMinutes(1); DateTime start2 = now.plusSeconds(50); DateTime end2 = now.plusMinutes(2); Interval interval = new Interval( start1, end1 ); … Read more