Working with java.util.Calendar
807588Feb 18 2009 — edited Feb 18 2009Thanks 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?
Second question,
Is it possible to parse date strings and not know the pattern before hand IE. specifying the pattern in the constructors of DateFormat/SimpleDateFormat. I will be working with dates that are randomly formatted and I cannot accomodate for each pattern. When I do not specify a pattern in the constructor and parse my dates, I get unparsable date exception etc. This seems to be a standard feature in most date/time facilities and I have been unable to find similar functionality in java, can someone point me in the right direction on how to do this?
Thanks,
Sam