I ran a quick test on daysBetween
function in Joda-Time library and I am getting inconsistent result. Does anyone else have the same problem?
Below is the code I use for testing.
public static int elapsedDaysJoda() {
DateTime dt1 = new DateTime(new Date());
Calendar cal = Calendar.getInstance();
cal.set(2011, 0, 1);
DateTime dt2 = new DateTime(cal.getTime());
Days days = Days.daysBetween(dt2, dt1);
return days.getDays();
}
public static void main(String[] args) {
for(int i=0; i < 10; i++) {
System.out.println(elapsedDaysJoda());
}
}