EPLHelpers: add date comparison functions

This commit is contained in:
2018-07-13 17:18:34 -07:00
parent 3aaf37202b
commit 73d380fb76

View File

@ -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;
}
}