It looks like you are using org.joda.time.DateTime
which is the wrong class for this requirement. The right class for this requirement would be org.joda.time.LocalDate
.
org.joda.time.LocalTime
is useful for representing human-based date-time, such as movie times, or the opening and closing times of the local library, or to create a digital clock etc. LocalDateTime
, a combination of LocalDate with LocalTime, can be used to represent a specific event, such as the first race for the Louis Vuitton Cup Finals in America's Cup Challenger Series, which began at 1:10 p.m. on August 17, 2013. Note that this means 1:10 p.m. in local time. (Source)
Switching to org.joda.time.LocalDate
should fix the issue. However, check the following notice at the Home Page of Joda-Time
Joda-Time is the de facto standard date and time library for Java
prior to Java SE 8. Users are now asked to migrate to java.time
(JSR-310).
Therefore, I suggest you switch to the modern date-time API* . You can learn about the modern date-time API from Trail: Date Time.
* For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7. If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.