Or, even better, use the overlaps() method:

if (appointment2.overlaps(appointment1)) {
      // do something
}

Stephen


Moritz Petersen wrote:
> Interval appointment1 = new Interval(dateTime1, period1);
> Interval appointment2 = new Interval(dateTime2, period2);
> 
> // == null means no overlap
> if (appointment2.overlap(appointment1) == null) {
>      // do something
> }
> 
> 
> Am 30.08.2007 um 05:03 schrieb Damian Corrin:
> 
>> Hi I have a very simple question but the answer seems to elude me.  
>> I am using joda time in particular DateTime and Period. The  
>> DateTime represent an appointment and the Period represents how  
>> long that appointment is for. What I want to know is if there is a  
>> simply way to determine when a new appointment is added whether or  
>> not the new appointment overlaps with any existing appointment  
>> DateTime and Period
>>
>> Cheers in advance
>>
>> Damian Corrin
>>
>> ---------------------------------------------------------------------- 
>> ---
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems?  Stop.
>> Now Search log events and configuration files using AJAX and a  
>> browser.
>> Download your FREE copy of Splunk now >>  http://get.splunk.com/ 
>> _______________________________________________
>> Joda-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to