Full details can be found on the website. However, let me draw out a few key features:
- Easy to Use - Calendar makes accessing 'normal' dates difficult, due to the lack of simple methods. Joda-Time has straightforward field accessors. And the index of January is 1!
- Extensible - Joda-Time supports multiple calendar systems via a plugin mechanism, which is much more extensible than the subclasses of Calendar. Currently supported calendars are ISO8601, GregorianJulian, Buddhist (Thai) and Coptic.
- Comprehensive - Joda-Time includes classes for datetimes, dates without times, times without dates, intervals and time periods.
- Advanced formatting - An advanced and extensible formatting mechanism is included, allowing input and output to string in a thread-safe manner.
- Well documented. There is documentation in the form of a quick and full user guide, plus reference pages, FAQs and javadoc.
- Tested. There is good test coverage, see the website, providing an assurance of quality.
- Built in security. Advanced operations that could prove a security risk (like changing the current time) are protected by standard JDK security.
And if you learn best by an example:
public boolean isRentalOverdue(DateTime datetimeRented) { Period rentalPeriod = Period.days(2); return datetimeRented.plus(rentalPeriod).isBeforeNow() } public boolean isJoinedInLastThreeMonths(DateTime datetimeJoined) { Interval last3Months = new Interval(Period.months(3), new DateTime()); return last3Months.contains(datetimeJoined); } public boolean isBirthdayInLeapYear(YearMonthDay dateOfBirth) { return dateOfBirth.year().isLeap(); }
So, now its released, what next? Well I hope that some of you reading this will want to help add some other calendar systems, such as Hebrew, Islamic, Chinese, etc. Any takers?