How can I check if a given startdate & enddate cuts a specific time period (train time).
I did following:
if ((startdate >= train.getStartDate()) &&
(enddate <= train.getEndDate())) {
// doSomething();
}
doSomething()
get only executed, when the time is exact between the given time period. But I want also that doSomething()
get executed, when the times are overlapped.
For example:
- Startdate: 14.10.2015 15.00
- Enddate: 16.10.2015 17.00
- Timeperiod: 15.10.2015 10.00 - 19.10.2015 10.00
In this case its overlapping and I want that doSomething()
get executed. Any solutions?