Finally a API for Date and Time Handling in Java

Have you ever had to do real work with Dates and Times in Java? Well, I had to and still have to. For Data and Time handling the Java API includes the Date and Calendar classes, but these classes leave a lot to desire. For instance: there is no class that represents a Date without Time information, or a class that represents Time without Date. Even worst, there is no class to support Durations. Until know what I did was to create the classes that I missed. For instance: I created a Duration class that represents Durations. It is weird to have to do these things, but it is a fact of life if you want to use Java Standard APIs.

But there is hope for the rest of us that really want a new and better API. JSR-310 Date and Time API is planed for Java 7 and should address these issues. They will finally create a simpler API, with all the missing parts like Durations, Date without Time and Time without Date, and so on...

The problem is we are still at least a year away from Java 7 and we need to develop applications now! What can we do? Well, when I found out about JSR-310, I also found out about Joda Time. This is an API that fills the gaps in the Standard Java API with a license that we can use even in our commercial applications. In fact, JSR-310 will take ideas from the Joda Time API, fill some gaps and address other issues: nothing more. It won't be a copy of the Joda Time API, but it should be a simpler version.

From what I saw in Joda Time API, I will definitely consider it whenever I do code that involves Dates and Times. The problem will be convincing management that we should adapt some of our existing code to use this API. But who knows: there might be some severe error in our code that using Joda Time would solve. Well... I'm wishing out loud. The facts are that we currently don't have time to breath, just time to write the simplest code that guest the job done, no matter if the code is the ugliest hack every written!

Comments

Popular posts from this blog

Back to C: CMake and CUnit

OpenClock and Gentoo

Gentoo with LUKS and LVM