Dates before January 1st, 1970

后端 未结 3 1704
余生分开走
余生分开走 2020-12-06 16:37

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

3条回答
  •  不思量自难忘°
    2020-12-06 17:15

    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!

    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.

提交回复
热议问题