I have a unique situation. I'm working on an old project that resides on an old WebLogic server that (A) doesn’t skip anything from Java 6 and (B) pollutes the class loader with the old version of JodaTime (version 1.2, to be precise).
The client I'm working on has a standard development platform that includes Java 8 and JodaTime for projects that are stuck in earlier versions of Java. So I got stuck using this old version of JodaTime (310-Backport would be a great solution, but I am not allowed to use it).
I need to create a utility method that checks if DateTimeafter today (regardless of time). JodaTime 1.2 doesn’t have LocalDateany convenient static factory methods like now(), so I came up with the following:
public static boolean isAfterToday(DateTime dateTime) {
YearMonthDay date = new YearMonthDay(dateTime);
YearMonthDay today = new YearMonthDay();
return date.isAfter(today);
}
This is a bit unpleasant, because in later versions of JodaTime everything in the class YearMonthDayis deprecated and replaced with LocalDate, which, unfortunately, I can not use. Is there a better way to do this? Also, I am trying to take the time off DateTimeby converting it to YearMonthDay... are there any "gotchas" that I skip or should know?
: , DateTime, , - GMT. , Apache Commons Guava.