在Java中操作和存储日期的最佳实践是什么? [英] What is the Best Practice for manipulating and storing dates in Java?

查看:297
本文介绍了在Java中操作和存储日期的最佳实践是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

操作和存储日期的最佳实践是什么?在企业Java应用程序中使用GregorianCalendar?

What is the Best Practice for manipulating and storing Dates e.g. using GregorianCalendar in an enterprise java application?

寻求反馈,我将把任何好的答案整合到其他人可以使用的最佳实践中。谢谢!

Looking for feedback and I will consolidate any great answers into a Best Practice that others can use. Thanks!

推荐答案

Joda 是要走的路。为什么?

Joda is the way to go. Why ?


  1. 它具有比标准日期/时间API更强大和直观的界面

  2. 日期/时间格式化没有线程问题。 java.text.SimpleDateFormat不是线程安全的(不是很多人都知道这个!)

在某些阶段,Java日期/时间API将被替换(由JSR-310)。我相信这将是基于Joda背后所做的工作,因此您将学习一种将影响新的标准Java API的API。

At some stage the Java Date/Time API is going to be superseded (by JSR-310). I believe this is going to be based upon the work done by those behind Joda, and as such you'll be learning an API that will influence a new standard Java API.

这篇关于在Java中操作和存储日期的最佳实践是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆