Skip to content

Instantly share code, notes, and snippets.

@Yogu
Created July 9, 2015 18:23
Show Gist options
  • Save Yogu/472ce6886b4e949734cc to your computer and use it in GitHub Desktop.
Save Yogu/472ce6886b4e949734cc to your computer and use it in GitHub Desktop.
import org.joda.time.LocalDate;
import org.joda.time.Years;
public class DateTest {
public static void main(String[] args) {
LocalDate start = LocalDate.parse("2012-01-28"); // leap year
LocalDate end = LocalDate.parse("2013-01-27");
LocalDate end2 = LocalDate.parse("2013-01-28");
System.out.println(end.isBefore(start.plus(Years.ONE))); // true
System.out.println(end2.isBefore(start.plus(Years.ONE))); // false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment