Skip to content

Joda-Time is the widely used replacement for the Java date and time classes.

Notifications You must be signed in to change notification settings

flightstats/joda-time

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Joda-Time (FlightStats edition)

FlightStats information

Flightstats Build Instructions

  • Make sure you're using JDK 1.7 (at least as of 2014j)
  • download tzdata file (from http://www.iana.org/time-zones, grab the "data" tgz)
  • note exact file size of the tgz
  • edit src/conf/MANIFEST.MF and
    • update all 2014? to the latest (eg. 2014i->2014j)
    • Update the OlsonDatabase-FileSize to be the size of the new tgz file
    • edit pom.xml to make the same version change (2014i->2014j)
  • cd to src/main/java/org/joda/time/tz/src
  • untar the tzdata.tar.gz into this directory, overwriting the existing files. Ignore any new files untarred, they can be deleted.
  • Commit the changes
  • At the root, type "mvn package"
  • You might need to fix a unit test if some bit of data changed (usually a country string/code).
  • upload to our artifactory. Choose the joda-time-2.2-xxx.jar from the target directory, upload to ext-release-local. It figures out the rest of the path for you from the pom.
    • repeat with the sources and javadoc jars
  • Email engineering with the updated version and a summary of which regions were affected and when the change will be important

Updating code to match Joda

Back to your regular documentation

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.

Documentation

Various documentation is available:

Releases

Release 2.9.7 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.7</version>
</dependency>

Gradle configuration:

compile 'joda-time:joda-time:2.9.7'

Related projects

Related projects at GitHub:

Other related projects:

Support

Please use GitHub issues and Pull Requests for support.

History

Issue tracking and active development is at GitHub. Historically, the project was at Sourceforge.

About

Joda-Time is the widely used replacement for the Java date and time classes.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.7%
  • Other 0.3%