What is the Best Practice for manipulating and storing dates in Java?

date, java

Solution

Joda is the way to go. Why ?

- it has a much more powerful and intuitive interface than the standard Date/Time API

- there are no threading issues with date/time formatting. java.text.SimpleDateFormat is not thread-safe (not a lot of people know this!)

At some stage the Java Date/Time API is going to be superseded (by JSR-310). I believe this is going to be based upon the work done by those behind Joda, and as such you'll be learning an API that will influence a new standard Java API.

Problem

What is the best practice for manipulating and storing Dates e.g. using GregorianCalendar in an enterprise java application? Looking for feedback and I will consolidate any great answers into a best practice that others can use.

Original source

Related problems