Core Java

How Badly Do We Want a New Java Date/Time API?

The current Java.net poll question is, “How critical is it for JSR-310 (new Date and Time API) to be implemented in Java 8?” At the time of my writing of this post, nearly 150 respondents have voted and an overwhelming percentage have answered either “Very” (53%) or “It would be nice, but we can get by using the current classes” (22%).

With 3/4 of the respondents feeling that it would either “be nice” or is “very important” to get a new Java Date/Time API, I think it’s safe to say that Java‘s current Date and Calendar approach has not grown on us. Perhaps my biggest surprise so far with the survey results is that 2% of the respondents have stated, “I prefer the current date and time classes.” Maybe that’s from the people who wrote those classes?

I tend to use Java’s date/time/calendar APIs off and on. When I use them, I really don’t like them, but do start to tolerate them. I begin to forget how much I loathe them until I use them again. I recently helped a colleague familiar with Java (but not with the date/time APIs) to understand how to do some Date/Calendar/String manipulation and presentation. Explaining this mess out loud to him made the ridiculous difficulty of using these too-flexible APIs even more obvious to me. I could see on his face that he was thinking I was either kidding him or didn’t know what I was talking about. Although I’ve gotten to the point where I can make them make do, it’s much more difficult than it should be.

Much has been written about the woes of date/time handling in Java. Rob Sanheim wrote in 2006 about date/time-related problems in three of his Top Five Worst APIs in Java (Calendar, Date, and DateFormat/SimpleDateFormat). Java’s Date-handling is focused on in Cameron Purdy‘s 2005 post The Seven Habits of Highly Dysfunctional Design. Tero Kadenius reminded us in the 2011 post Handling dates in Java that “The date/time API in Java is notoriously painful to work with.” The aptly named post Java Dates Still Suck was published in 2009.

The current Java.net survey confirms my feeling after working with numerous Java developers and after reading many blogs and articles that the vast majority of Java developers are anxious to get a better standardized way of handling dates and times in Java.

Reference: How Badly Do We Want a New Java Date/Time API?  from our JCG partner Dustin Marx at the Inspired by Actual Events  blog.

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button