This is a fork of the official Joda-Time project updated with the latest tzinfo database. The latest tzinfo database can be downloaded from http://www.iana.org/time-zones
How to keep this fork up to date:
- Download the latest tzdata file from http://www.iana.org/time-zones. Note the version (i.e. 2016f).
- Update the version in src/conf/MANIFEST.MF to match the latest version (i.e. 2.9.4-2016f).
- Update version and tz.database.version in pom.xml to match.
- Untar the downloaded tzdata file into src/main/java/org/joda/time/tz/src, overwriting the existing files. Any new files can be ignored and should be deleted (git clean -f -n; -n will show you which files would be deleted, run again without -n to delete them).
- Test building the joda-time jar using 'mvn clean test package'. You may need to install maven (brew install maven).
- If everything looks good, commit your changes.
Joda-Time provides a quality replacement for the Java date and time classes. The design allows for multiple calendar systems, while still providing a simple API. The 'default' calendar is the ISO8601 standard which is used by XML. The Gregorian, Julian, Buddhist, Coptic, Ethiopic and Islamic systems are also included, and we welcome further additions. Supporting classes include time zone, duration, format and parsing.
As a flavour of Joda-Time, here's some example code:
public boolean isAfterPayDay(DateTime datetime) {
if (datetime.getMonthOfYear() == 2) { // February is month 2!!
return datetime.getDayOfMonth() > 26;
}
return datetime.getDayOfMonth() > 28;
}
public Days daysToNewYear(LocalDate fromDate) {
LocalDate newYear = fromDate.plusYears(1).withDayOfYear(1);
return Days.daysBetween(fromDate, newYear);
}
public boolean isRentalOverdue(DateTime datetimeRented) {
Period rentalPeriod = new Period().withDays(2).withHours(12);
return datetimeRented.plus(rentalPeriod).isBeforeNow();
}
public String getBirthMonthText(LocalDate dateOfBirth) {
return dateOfBirth.monthOfYear().getAsText(Locale.ENGLISH);
}
Joda-Time is licensed under the business-friendly Apache 2.0 licence.
Various documentation is available:
- The home page
- Two user guides - quick and full
- The Javadoc
- The FAQ list
- Information on downloading and installing Joda-Time including release notes
Release 2.9.4 is the current latest release. This release is considered stable and worthy of the 2.x tag. It depends on JDK 1.5 or later.
Available in the Maven Central repository
Maven configuration:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
Gradle configuration:
compile 'joda-time:joda-time:2.9.4'
Related projects at GitHub:
- https://github.com/JodaOrg/joda-time-hibernate
- https://github.com/JodaOrg/joda-time-jsptags
- https://github.com/JodaOrg/joda-time-i18n
Other related projects:
Please use GitHub issues and Pull Requests for support.
Issue tracking and active development is at GitHub. Historically, the project was at Sourceforge.