hi, good day, i'm actually want to compare a date see whether is the date fall into the range between start date and end date , is that any utility class in apache common that can help up this ? or anyone can suggest the idea to compare ? thank you for guidance
so in this case , new start and end date have fall into existing start and end date range, cause it should not interlapse the date range - in short, new start_date and end_date cannot in between of existing start_date and end_date , how i write a algorithm on this ? thank you for guidance
Joined: Sep 16, 2005
Take a look at SimpleDateFormat. It can parse a string into a Date, then as I mentioned, dates are comparable.
Joined: Apr 13, 2005
jeff, i facing more on the problem of algorithm that check the date range
Since your comparison method is mainly for comparing, you shouldn't keep the conversion codes in it.
There're only 4 situations whereby 2 date ranges overlap: 1. Range 1 is larger than Range 2 entirely 2. Range 1 is the same as Range 2 3. Range 1's end date is the same or later than Range 2's start date 4. Range 1's start date is the same or earlier than Range 2's end date
Focus on getting these conditions right first, without bothering about the conversion from String to Date objects. Write a separate method to do the conversion. This way, you would know which is the method that is wrong.