eneylon

Time Please

In code on September 11, 2007 at 8:38 pm

Java has got its date and time support into a complete mess. For a language that’s only a dozen years old (I remember looking at the aplha release in 1995, so from my perspective it’s about to become a teenager), there wasn’t too much thought given to handling one of the fundamental capabilities of computer systems. I’m not sure what the architectural considerations were employed when constructing this solution, but it is not good. In particular, it is hard to simply access a date: the constructors are abstract because the designers want people to use calendars as the primary way to access the date! Using Calendar as the computation object is anti-intuitive.

Fortunately help is at hand. Joda-Time provides a quality replacement for the Java date and time classes. It’s being used as the basis for the new Java Date and Time API (JSR310 for the code geeks out there) and the hope is that this will make it into Java 7. Whether it is the future implementation or not is moot – it provides fanastic date and time handling capabilities out of the box and it is here, now.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: