Forums Register Login
Getting the maximum/min date java.util.Calendar can accomodate
Thanks to everyone in advance -

Coming from other languages such as PHP, the DateTime object has max and min dates that the respective object will allow. For instance PHP's DateTime is:

$MinValue = "1901-12-13 20:45:54";
$MaxValue = "2038-01-19 03:14:07";

And C#:


I have played around with calendars getMinimum/getMaximum methods and here is what I come up with

this is the minimum date - Thu, 1 Jan 0001 00:00:00 -0700 (does not change)

this is the max date - Wed, 17 Apr 292269054 21:34:07 -0700 (the second is constantly changing)

Am I on the right path or is there a better way to get max/min Calendar dates that are constant?



Sort of, but you can get earlier dates than that by using negative numbers. As you can see, you can use any date which would be of any use to any human being in Java. So whereas the question might have a point in PHP, it doesn't have a point in Java.

This thread has been viewed 7081 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 11, 2018 21:55:58.