Differences between Java 8 Date Time API (java.time) and Joda-Time

Common features a) Both libraries use immutable types. Joda-Time also offers additional mutable types like MutableDateTime. b) Furthermore: Both libraries are inspired by the design study “TimeAndMoney” from Eric Evans or ideas from Martin Fowler about domain driven style so they strive more or less for a fluent programming style (although not always perfect ;-)). … Read more

Number of days between two dates in Joda-Time

Annoyingly, the withTimeAtStartOfDay answer is wrong, but only occasionally. You want: Days.daysBetween(start.toLocalDate(), end.toLocalDate()).getDays() It turns out that “midnight/start of day” sometimes means 1am (daylight savings happen this way in some places), which Days.daysBetween doesn’t handle properly. // 5am on the 20th to 1pm on the 21st, October 2013, Brazil DateTimeZone BRAZIL = DateTimeZone.forID(“America/Sao_Paulo”); DateTime start … Read more