Joda Time是否已被Java 8 Date and Time API弃用? (java.time) [英] Is Joda Time deprecated with java 8 Date and Time API? (java.time)
问题描述
如果我可以使用Java 8日期和时间API( java.time
),是否有任何理由使用Joda Time?
我应该使用每次Java 8日期和时间?
Is there any reason to use Joda Time if I can use Java 8 Date and Time API (java.time
)?
Should I use Java 8 Date and Time every time?
推荐答案
Joda-time本人的官方声明是迁移只要Java-8可用。另请参阅网站中的引用:
The official statement of the author of Joda-time himself is to migrate as soon as Java-8 is available. See also this citation from the website:
请注意,Joda-Time被认为是一个基本上完成的项目。
未计划任何重大改进。如果使用Java SE 8,请将
迁移到java.time(JSR-310)。
Note that Joda-Time is considered to be a largely "finished" project. No major enhancements are planned. If using Java SE 8, please migrate to java.time (JSR-310).
所以简短回答你的问题是:是(已弃用)。但是,请记住一些功能,如Joda - Interval
或 PeriodType
或 PeriodFormatter
在Java-8中不可用,因此您必须编写自己的部分丑陋的解决方法,另请参阅我的 SO-post 关于Joda-Time和JSR-310之间的差异。
So the short answer to your question is: YES (deprecated). However, keep in mind that some features like Joda-Interval
or PeriodType
or PeriodFormatter
are not available in Java-8 so you have to write your own partially ugly workarounds, see also my SO-post about differences between Joda-Time and JSR-310.
关于两个图书馆未来的侧面评论:
Side remarks about the future of both libraries:
完成在这种情况下意味着什么?
嗯,你可以比较 Joda-issue 254 使用我的 Twitter上的小讨论。我认为人们应该对Joda-Time的任何重大改进设定他们的期望。还请考虑有关Joda-Time的未来开发资源有限(缺乏人力)。而且说实话:自2008年Joda-Time以来的大多数版本都具有bugfix版本的特性(2.0除外)。
Well, you can compare the Joda-issue 254 with my small discussion on Twitter. I think people should rather set down their expectations to any major enhancement of Joda-Time. Please also consider that the future development resources regarding Joda-Time are limited (lack of manpower). And let's be honest: Most releases since Joda-Time in year 2008 rather have the character of bugfix releases (with the exception of 2.0).
另一方面: JSR-310的创新速度也可能不会很高(因为它已经很大了,因为Oracle在这里是决定性的参与者而且日期时间库通常不被认为是任何Java发布的核心基础)。因此,未来外部库总会留出一些空间来提供缺失的功能,例如(按字母顺序排列):
On the other side: The innovation speed of JSR-310 will probably not be very high, too (because it is already big, and because Oracle is here the decisive player and a date-time-library is in general not considered as the central cornerstone of any Java-release). So there is always some space left for an external library in the future to supply missing features, for example (in alphabetical order):
- < a href =https://github.com/ThreeTen/threeten-extra =noreferrer> Threeten-Extra (作为Basil Bourque的最爱,见他的评论)
- Time4J (我自己的扩展,2015年夏季解决了互操作性问题)
- Threeten-Extra (as the favourite of Basil Bourque, see his comment)
- Time4J (my own extension, interoperability issue solved in summer 2015)
这篇关于Joda Time是否已被Java 8 Date and Time API弃用? (java.time)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!