Java News from Friday, February 2, 2007

Next Tuesday, February 6, will be the second iteration of Extreme Tuesday New York. This will be held at the Silver Swan at 41 East 20th Street.


Stephen Colebourne has submitted JSR-306, Date and Time API, to the Java Community Process. According to the JSR,

This JSR will provide a new and improved date and time API for Java. The main goal is to build upon the lessons learned from the first two APIs (Date and Calendar) in Java SE, providing a more advanced and comprehensive model for date and time manipulation.

The new API will be targeted at all applications needing a data model for dates and times. This model will go beyond classes to replace Date and Calendar, to include representations of date without time, time without date, durations and intervals. This will raise the quality of application code. For example, instead of using an int to store a duration, and javadoc to describe it as being a number of days, the date and time model will provide a class defining it unambiguously.

The new API will also tackle related date and time issues. These include formatting and parsing, taking into account the ISO8601 standard and its implementations, such as XML. In addition, the areas of serialization and persistence will be considered.

The final goal of the new API is to be simple to use. The API will need to contain some powerful features, but these must not be allowed to obscure the standard use cases. Part of being easy to use includes interaction with the existing Date and Calendar classes, something that will be a key focus of the Expert Group.

Dates and times are extremely tricky to model, much trickier than what we usually naively expect. For example, how do yo handle both times with a specific time zone and ones in which the time zone is not specified? Comments are due by February 12.