Forums Register Login

Working with dates in java - JDK VS Joda ?

+Pie Number of slices to send: Send
I wanted to get the number of days between two dates (string or date objects).
I have looked at some posts here and there, and especially on stackoverflow.
It seems that people prefer Joda over JDK. How do I decide which one to use ?
Joda seems to be a small project, not backed by big corporations like Oracle.
What if the support for Joda is stopped soon ? Then what will I do if I find some
bug in the Joda API ? Are there any dangers in using Joda ?
2
+Pie Number of slices to send: Send
 

David Jason wrote:Joda seems to be a small project, not backed by big corporations like Oracle.



This is a major misunderstanding. Joda was considered for inclusion in Java 7, although in the end it was left out. It is extremely unusual for outside projects to be taken into the Java API, in fact I can't think of a single instance where that has ever happened. So "not backed by... Oracle" is about as far from the truth as it's possible to get.

What if the support for Joda is stopped soon ? Then what will I do if I find some
bug in the Joda API ? Are there any dangers in using Joda ?



It's an open-source project. And as I noted above, it's a very high-profile project and it isn't likely to go away anytime soon. But even if all of the people involved in maintaining and updating it were swept out to sea tomorrow and never seen again, that wouldn't matter. The source code is accessible to anybody in the world, and bugs can be repaired by anybody too. In fact they are more likely to be fixed quickly than bugs found in the standard API are -- and there are still bugs in the Calendar implementations even to this day. Being backed by a big corporation isn't all it's cracked up to be.
+Pie Number of slices to send: Send
 

David Jason wrote:Joda seems to be a small project, not backed by big corporations like Oracle.


Just to chime in with Paul. SSL/SSH would probably be categorized as a "small project" too (and it's open source), yet after 15 years it still provides the backbone for most secure transactions and communication on the Internet.
And what major corporation still refuses to include it as part of their wonderful Operating System? Hmmm....let me think....

And why not? Because they can't charge you for it.

As for Joda Time, it's a single-focus project that came about specifically because Java's native support for all things date- (and more specifically time-) related is so bad.

Winston
1
+Pie Number of slices to send: Send
To me, the answer would be simple: always use Joda Time, because it has a much better design, is much more complete and consistent than the date and time APIs in Java's standard library.

Paul Clapham wrote:Joda was considered for inclusion in Java 7, although in the end it was left out.


The author of Joda Time (Stephen Colebourne) is still working on Project ThreeTen, which is a new date and time API to be included in Java's standard library, based on Joda Time. It didn't make it into Java 7, but maybe it will be included in Java 8 (or a later Java version).
+Pie Number of slices to send: Send
 

Jesper de Jong wrote:The author of Joda Time (Stephen Colebourne) is still working on Project ThreeTen, which is a new date and time API to be included in Java's standard library, based on Joda Time. It didn't make it into Java 7, but maybe it will be included in Java 8 (or a later Java version).


Thanks for that Jesper. I've been wondering what's going on with 310. I wonder if he'll be producing any 'beta' jars for us?

Winston
+Pie Number of slices to send: Send
There are still people out there that use the JDK date API? Comparing the Java dates API vs Joda is like bringing a butter knife to a gun fight.

Joda has been around a long time, is mature, and is probably one of the most used 3rd party Java libraries in existence.
2
+Pie Number of slices to send: Send
Well, you have to admit, when you're a beginner who can't even configure a classpath correctly, the idea of downloading a jar file from a website and making your application work correctly with it is a bit daunting.

And most of the people who post here struggling with how to find the number of days between two dates, using the JDK classes, are working in a conservative environment where if it isn't on the exam then it isn't worth knowing, and any advances made since 2002 are dangerously radical innovations. (Okay, I exaggerate somewhat, but that theory explains a lot of the posts you see here.)
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1105 times.
Similar Threads
Date API
Java framework for time management
Date used as String datatype
Woa! Why does Date/Calendar do this?
People suggest using Date class is deprecated, then for handling Date which class should be used???
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:34:01.