I’m creating a web based system which will be used in countries from all over the world. One type of data which must be stored is dates and times.
What are the pros and cons of using the Java date and time classes compared to 3rd party libraries such as Joda time? I guess these third party libraries exist for a good reason, but I’ve never really compared them myself.
EDIT: Now that Java 8 has been released, if you can use that, do so!
java.timeis even cleaner than Joda Time, in my view. However, if you’re stuck pre-Java-8, read on…Max asked for the pros and cons of using Joda…
Pros:
java.timein Java 8, as they’re at least somewhat similarCons:
DateTimeZoneBuildereffectively in the past. This is a very rare use case though.To respond to the oxbow_lakes’ idea of effectively building your own small API, here are my views of why this is a bad idea: