Java 8 LocalDate has two meanings. LocalDate.MAX and LocalDate.MIN
LocalDate.MAX - The maximum supported LocalDate, '+ 999999999-12-31'. This can be used by the app as a โfar futureโ date.
LocalDate.MIN - The minimum supported LocalDate, '-999999999-01-01'. This can be used by the application as the date of the "distant past."
Note: they do not go to Long.MIN_VALUE or Long.MAX_VALUE.
I suggest using Java 8 if you are transitioning from C # and how the date / time works, since it has an AND closure and a new DateTime API based on JodaTime. This new DateTime API is the one you should use if you are worried about the future of the API.
I think you can assume that Long.MIN_VALUE and Long.MAX_VALUE will never change, because they are based on determining how signed 64-bit values โโwork. (How work with 64-bit values โโwas standardized before you were born is likely). You can also assume that Date will not change because it has not changed much since its release, and since it has been replaced, there is even less reason to change it. Theoretically, this might be deprecated, but in fact there is still too much code that uses it.
IMHO, I use long to represent the time in milliseconds ala System.currentTimeMillis (), and I use Long.MIN_VALUE and Long.MAX_VALUE.
If you are worried about using a good API and future code verification, I suggest you avoid using Calendar. Not that everything was bad, but there is every reason to replace it.
source share