Parsing date by multiple formats with pivotYear set up for 2 digit years
问题 I am having trouble to implement "simple" parsing of a date. The requirement is to allow enter year in two or four digits. When two digits are entered then make the split date for deciding into what century it belongs the first of January next year. Here is what I have so far: DateTime now = new DateTime(); int pivotYear = now.getYear() - 49; // 2013 - 49 = 1964 where 49 is the DateTimeParser[] parsers = { DateTimeFormat.forPattern("dd/MM/yy").withPivotYear(pivotYear).withLocale(new Locale(