DateTime dt_startdate = new DateTime( startdate );
DateTime dt_enddate = new DateTime( enddate );
int days = Days.daysBetween(dt_startdate, dt_enddate).getDays();
I am compiling with JDK 1.5 update 05. I added the joda-time-2.3.jar and went to compile.
But it comes back with an error:
Error: duplicate definition of method compareTo(java.lang.Object) in class org.joda.time.base.AbstractInstant
Error: duplicate definition of method compareTo(T) in interface java.lang.Comparable
Error: duplicate definition of method compareTo(java.lang.Object) in class org.joda.time.base.AbstractInstant
if I comment out the code, it compiles fine.
I have also tried this with joda-time-2.2.jar and got the same error.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was messing with Joda in my project.
Did some basic code:
DateTime dt_startdate = new DateTime( startdate );
DateTime dt_enddate = new DateTime( enddate );
int days = Days.daysBetween(dt_startdate, dt_enddate).getDays();
I am compiling with JDK 1.5 update 05. I added the joda-time-2.3.jar and went to compile.
But it comes back with an error:
Error: duplicate definition of method compareTo(java.lang.Object) in class org.joda.time.base.AbstractInstant
Error: duplicate definition of method compareTo(T) in interface java.lang.Comparable
Error: duplicate definition of method compareTo(java.lang.Object) in class org.joda.time.base.AbstractInstant
if I comment out the code, it compiles fine.
I have also tried this with joda-time-2.2.jar and got the same error.
If I had to guess, I'd say that you are compiling with a source flag of 1.4, not 1.5.
The methods were altered in Joda-Time when generics were added in 1.5. I'd also suggest using a more up to date JDK, version 5 is stone age.