private static SimpleDateFormat createFormatter(String fmt, boolean proleptic) {
    SimpleDateFormat result = new SimpleDateFormat(fmt);
    GregorianCalendar calendar = new GregorianCalendar(UTC);
    if (proleptic) {
      calendar.setGregorianChange(new Date(Long.MIN_VALUE));
    }
    result.setCalendar(calendar);
    return result;
  }
Conversion utilities from the hybrid Julian/Gregorian calendar to/from the
proleptic Gregorian.

The semantics here are to hold the string representation constant and change
the epoch offset rather than holding the instant in time constant and change
the string representation.

These utilities will be fast for the common case (&gt; 1582 AD), but slow for
old dates.
storage-api/src/java/org/apache/hadoop/hive/common/type/CalendarUtils.java