Win a copy of Microservices in Action this week in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?



Posts: 23889
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!