diff --git a/src/main/java/EPLHelpers.java b/src/main/java/EPLHelpers.java index 96377a5..fd3b6ae 100644 --- a/src/main/java/EPLHelpers.java +++ b/src/main/java/EPLHelpers.java @@ -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; + } }