check if date is within time range using joda or standart java api

I have first time as string '12:00:00' and another '19:00:00'

next how to check time portion of the day is within these time values?

This question and answers originated from www.stackoverflow.com
Question by (5/25/2010 7:31:38 AM)

Answer

Using Joda Time you could do something like this:

DateTime start = new DateTime(2010, 5, 25, 12, 0, 0, 0);
DateTime end = new DateTime(2010, 5, 25, 21, 0, 0, 0);
Interval interval = new Interval(start, end);
DateTime test = new DateTime(2010, 5, 25, 16, 0, 0, 0);
System.out.println(interval.contains(test));
Answer by

Find More Answers
Related Topics  java  datetime  jodatime
Related Questions