aspose file tools*
The moose likes Beginning Java and the fly likes Getting the maximum/min date java.util.Calendar can accomodate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting the maximum/min date java.util.Calendar can accomodate" Watch "Getting the maximum/min date java.util.Calendar can accomodate" New topic
Author

Getting the maximum/min date java.util.Calendar can accomodate

Sam Ingrassia
Greenhorn

Joined: Feb 18, 2009
Posts: 4
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#:

DateTime.MaxValue
DateTime.MinValue

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?


Thanks,

Sam




Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18155
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the maximum/min date java.util.Calendar can accomodate
 
Similar Threads
Error passing in a date object
Encountering a DateTime problem while displaying a date using Jexcel
Using setDate(column,Date) to insert date in sybase database
Joda DateTime
need 2 rows rather than 5 from this query