Java: how do I check if a Date is within a certain range? -


I have the series with the start date and end dates. I want to see to see that a date is within that limit.

date First () and date To use the latter () seems a little weird. I want something like this pseudocode:

  Boolean is Vithinrange (date testdate) {return testdate & gt; = StartDate & amp; Amp; TestDate & lt; = EndDate; }  

Of course, it is relevant, but the dates dragging from the database are timestamps

  Boolean havithinrange (date trial date) {return! (TestDate.before (startdate) || testDate.after (ENDDATE)); }  

I think that does not seem weird, note that I wrote it in that way instead of

  return testdate. After (start date) & amp; Amp; TestDate.before (ENDDATE);  

Then it will also work, if the end of the exam is equal to one of the last cases.


Comments