The Source for Java Technology Collaboration
User: Password:



Michael Nascimento Santos

Michael Nascimento Santos's Blog

It's high time: a Date and Time API for the Java SE Platform

Posted by mister__m on February 09, 2007 at 08:59 AM | Comments (7)

A few times in the past I've considered writing a blog entry summing up all the problems with Date, Calendar, TimeZone, DST rules and other JDK related classes. If you think these APIs are simple, functional and do not cause any harm, believe me, you really haven't done anything trivial with dates. Besides the classic "days are 1-based, month are 0-based" issues and the lack of many major concepts, such as date without time, any date/time calculation fails miserably when it includes a DST start or end date. There are simply too many issues with the current API to list here.

However, the point of this entry is not to bash the current Java SE API, but rather to talk about JSR-310: Date and Time API. As stated in the JSR, it "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."

Our main inspiration will be Joda-Time, a great open-source library originally created by Stephen Colebourne (who will be co-leading the JSR), that you should definitely use today to deal with date and time. We won't simply rename Joda-Time and bless it with the JCP approval stamp. We actually want to learn from it, use Java SE 5 features to design an easier-to-use API, remove all deprecated, complex and not mature enough features and also consider addressing a few issues currently not solved by it.

If you want to help us, join the jsr-310 java.net project and subscribe to the mailing lists. If you think you are an expert on the matter, consider joining the expert group. We intend to run this JSR as transparently as possible though, so your voice will be heard even if you just join the java.net project.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Please have a look as JodaTime. I use it a lot, i find it much easer to work with than Sun's calendar API, which sometimes work, and for odd reasons cannot even transform one date in one time zone to another without coding at least a whole page :(.

    Posted by: wildfire on February 12, 2007 at 06:57 AM

  • sounds great :)

    Posted by: asjf on February 12, 2007 at 08:24 AM

  • JodaTime is a great library - I'm glad to see that the jodatime people are involved in the JCP.

    Posted by: hexghost on February 12, 2007 at 09:21 AM

  • +1 for Joda Time. Very Straight Forward.
    http://www.joda.org/

    Posted by: gesker on February 12, 2007 at 10:11 AM

  • I posted a thread on the forum about this some weeks ago, to which no one replied. I'm so glad I'm not the only one who is concerned with the current representations of date and time in Java. I wait with baited breath!

    Posted by: dansiviter on February 13, 2007 at 12:30 AM

  • Even doing fairly trivial things with the existing API is nothing but painful. It seems the simplest tasks such as creating dates/calendars for set dates and times seem to take up way to much code. I'm glad to see that the jodatime people are involved with the JCP at the highest levels.

    Posted by: luke_sleeman on February 13, 2007 at 12:49 AM

  • Even doing fairly trivial things with the existing API is nothing but painful. It seems the simplest tasks such as creating dates/calendars for set dates and times seem to take up way to much code. I'm glad to see that the jodatime people are involved with the JCP at the highest levels.

    Posted by: davidcomass on May 20, 2007 at 04:48 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds