EPLHelpers: add date comparison functions
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.joda.time.DateTimeComparator;
|
||||
|
||||
|
||||
public class EPLHelpers {
|
||||
@ -10,4 +11,20 @@ public class EPLHelpers {
|
||||
public static int getHour(DateTime date) {
|
||||
return date.getHourOfDay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two times and return true if the first is earlier than
|
||||
* the second.
|
||||
*/
|
||||
public static boolean earlierThan(DateTime a, DateTime b) {
|
||||
return DateTimeComparator.getInstance().compare(a, b) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two times and return true if the first is later than
|
||||
* the second.
|
||||
*/
|
||||
public static boolean laterThan(DateTime a, DateTime b) {
|
||||
return DateTimeComparator.getInstance().compare(a, b) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user