Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use threeten instead of joda-time

Tags:

I came across https://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html.

1) I am currently migrating Java Calendar to joda-time. I was wondering, should I use threeten instead of joda-time? Is threeten production ready?

2) Can threeten library and joda-time libraries exist together in a same application? As I am using some 3rd parties libraries, which is using joda-time library too.

3) Will joda-time become an abandon project since there is threeten?

like image 277
Cheok Yan Cheng Avatar asked Jan 07 '11 06:01

Cheok Yan Cheng


People also ask

What is the replacement of Joda-time?

Correct Option: D. In java 8,we are asked to migrate to java. time (JSR-310) which is a core part of the JDK which replaces joda library project.

Is Joda-Time deprecated?

So the short answer to your question is: YES (deprecated).

What is difference between Joda-Time and Java Time?

Joda-Time has a constructor that accepts an Object and performs type conversion. java. time only has factory methods, so conversion is a user problem, although a parse() method is provided for strings.

Why use Joda-Time?

Joda-Time is the most widely used date and time processing library, before the release of Java 8. Its purpose was to offer an intuitive API for processing date and time and also address the design issues that existed in the Java Date/Time API.


2 Answers

Official reply:

As of January 2011, ThreeTen is still what I'd classify as an Alpha. That means that I am changing method names, classes appear and disappear etc. That said, the code that is there is basically sound and tells the right time.

As such, I currently advise projects to use Joda-Time until ThreeTen enters Beta, which will be this year (2011) at some point.

It is possible to have both Joda-Time and ThreeTen in the same application. When ThreeTen is stable I intend to add the interfaces from ThreeTen to Joda-Time providing interoperability. However, interoperability will never be easy as the classes have the same names.

Joda-Time will continue to be released for a good period after ThreeTen is complete. But there will be a push to move to ThreeTen if JSR-310 completes such that it is in Java SE 8.

Update, March 2014,

As of 2014-03-05, JSR-310 was approved for inclusion in Java JDK 8. For more information, see the ThreeTen home page.

like image 178
JodaStephen Avatar answered Oct 15 '22 14:10

JodaStephen


This is just a suggestion what I would do.

Since Joda-time is heavily tested by lots of users and they still recommend it, that means it's a good library. JSR-310 -- I haven't seen this before this post of yours. Also, I am not sure how many people are using it -- or if it's completely bug free. May be it solves the Joda-time issues mentioned in the link that you have posted, but what guarantees that it is not having a newer bug.

That said, I will wait for JSR-310 to mature and be popular. And probably use in some of the non-critical projects. And, probably, eventually accept it as the blogger says, "(JSR-310 is) an API 'inspired by Joda-Time'" . In the mean time, I will use Joda-time.

Looking around the stuffs regarding it, I found this: http://sourceforge.net/apps/mediawiki/threeten/index.php?title=ThreeTen

It quotes:

The ThreeTen project is still in Alpha so methods may appear and disappear at any point. (Status - December 2010)

I WOULD RECOMMEND TO NOT TO USE IT RIGHT AWAY

like image 32
Nishant Avatar answered Oct 15 '22 13:10

Nishant