Java: What/where are the maximum and minimum values of a GregorianCalendar?
问题 What are the maximum and minimum values of a GregorianCalendar? Are they in a constant like Integer.MAX_VALUE, or maybe GregorianCalendar.get(BLAH)? In a nutshell, how can I create a GregorianCalendar instance with min/max value? 回答1: This should work: GregorianCalendar maxgc = new GregorianCalendar(); maxgc.setTime(new Date(Long.MAX_VALUE)); GregorianCalendar mingc = new GregorianCalendar(); mingc.setTime(new Date(Long.MIN_VALUE)); 回答2: I took joekutner's suggestion and ran it with: