1970年1月1日之前的日期 [英] Dates before January 1st, 1970

查看:224
本文介绍了1970年1月1日之前的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

getTime() 以特定日期的毫秒获取时间。这可以用于18世纪的日期。我们使用millis并将其存储在字符串变量中以供将来比较。过去可以使用多长时间有限制吗?

The getTime() fetches the time in millis for a certain Date. Can this be used reliably for dates say in the 18th century. We use the millis and store it in a string variable for future comparison. Is there a limit on how far in the past that this could be used?

推荐答案

我强烈建议你看看如果您正在对遥远的过去进行日期/时间比较,请 JodaTime 。或者实际上是任何类型的日期/时间比较和计算。这是一个很棒的图书馆!

I would highly recommend you take a look at JodaTime if you are doing date/time comparisons of the distant past. Or actually any sort of date/time comparisons and calculations. It is a great library!

不要依赖getTime()来做你想做的事情。至少考虑使用Java的 Calendar / GregorianCalendar 。但就个人而言,我建议使用JodaTime。

Don't rely on getTime() for what you want to do. At least consider using Java's Calendar/GregorianCalendar. But personally, I'd suggest using JodaTime.

这篇关于1970年1月1日之前的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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