Friday, March 04, 2005

Joda-Time v1.0

I came across a new date and time API for the Java community the other day, but I did not get a chance to do anything with it until tonight.  The package is called Joda-Time v1.0.  Joda-Time provides a quality replacement for the Java date and time classes.

It is very easy to get up to speed with Joda-Time.  The main object that you will deal with if you are just doing regular date and time manipulations is the org.joda.time.DateTime class.  I refactored a couple of my classes tonight and I can say that using DateTime is far simpler than using the Date and Calendar objects from java.util.

I can actually create a new DateTime object, add some specified duration to it, and assign it to a variable all in one line of code.  Using the classes from java.util, I would have to get a Calendar object instance.  From that, I could add some specified duration.  To finally get a Date object, I call a method called getTime().  Geez!

Joda-Time is a very nice project.  The documentation is very clean and the web site has all of their JCoverage information for their unit tests.

Technorati Tags: ,

No comments: