java - How to Compare Dates and Times? -


how can compare whether 2 datetimes same or @ least overlap?

for example, let's have following 2 sets of start , stop times:

start time: 2011-07-21 9:00am stop time: 2011-07-21 10:00am

start time: 2011-07-21 9:05am stop time: 2011-07-21 10:30am

the datetimes not match exactly, can't straight equality test. however, purposes datetimes overlap sufficient deemed match, how can test type of overlap?

i highly recommend use jodatime , overlap method.

from javadoc, not tell if 2 intervals overlap. tells overlapping interval is.

returns: overlap interval, null if no overlap


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -