title: What is the best way to parse a date in MM/DD/YY format and adjust it to the current / previous century?
body: <p>One of our customers wants to be able to enter a date with only 2 digits for the year component. The date will be in the past, so we want it to work for the previous century if the 2 digit year is after the current year, but work for the current century if the 2 digit year is equal to or less than the current year.</p>
  
  <p>as of today 10/30/2008</p>
  
  <p>01/01/01 = 01/01/2001</p>
  
  <p>01/01/09 = 01/01/1909</p>
  
  <p>This is a strange requirement, and I solved the problem, I just don't like my solution.
  It feels like there is a better way to do this.</p>
  
  <p>Thanks for the help.</p>
  
  <pre><code>public static String stupidDate(String dateString)
  {
      String twoDigitYear = StringUtils.right(dateString, 2);
      String newDate = StringUtils.left(dateString, dateString.length() - 2);
      int year = NumberUtils.toInt(twoDigitYear);
      Calendar c = GregorianCalendar.getInstance();
      int centuryInt = c.get(Calendar.YEAR) - year;
      newDate = newDate + StringUtils.left(Integer.toString(centuryInt), 2) + twoDigitYear;
      return newDate;
  }
  </code></pre>