Java API – Joda Time vs Java Time Comparison

apijavajoda-time

Although Joda is feature rich and more sophisticated than standard Java time, it may not always be the best thing to use. How do I decide if I should use Joda Time or Java Time in any Java code?

Is there some kind of guideline which tells us how to pick the right one depending on our requirements?

Best Answer

Joda Time is such an improvement over the Java time library that it is almost always the right choice, apart from the following exceptions:

  1. When it is difficult or undesirable to add third party dependencies to your project

  2. When its use in a public interface would cause issues, e.g. getting an ORM to handle both java and Joda time fields

However, in the case of 2) it would still be better to use Joda internally if possible.

The above things are worth keeping in mind, but should be rare. If in doubt, go with Joda.

Related Topic