code: public static Date getDate(String d) throws ParseException {
          Date date = null;
          if (d == null) {
              throw new IllegalArgumentException("Passed date is null");
          }
          switch (d.length()) {
          case 14:
              date = parse14DigitDate(d);
              break;
  
          case 17:
              date = parse17DigitDate(d);
              break;
  
          case 12:
              date = parse12DigitDate(d);
              break;
             
          case 0:
          case 1:
          case 2:
          case 3:
              throw new ParseException("Date string must at least contain a" +
                  "year: " + d, d.length());
              
          default:
              if (!(d.startsWith("19") || d.startsWith("20"))) {
                  throw new ParseException("Unrecognized century: " + d, 0);
              }
              if (d.length() < 8 && (d.length() % 2) != 0) {
                  throw new ParseException("Incomplete month/date: " + d,
                      d.length());
              }
              StringBuilder sb = new StringBuilder(d);
              if (sb.length() < 8) {
                  for (int i = sb.length(); sb.length() < 8; i += 2) {
                      sb.append("01");
                  }
              }
              if (sb.length() < 12) {
                  for (int i = sb.length(); sb.length() < 12; i++) {
                      sb.append("0");
                  }
              }
              date = parse12DigitDate(sb.toString());
          }
  
          return date;
      }
docs: Parses an ARC-style date.  If passed String is < 12 characters in length,
  we pad.  At a minimum, String should contain a year (>=4 characters).
  Parse will also fail if day or month are incompletely specified.  Depends
  on the above getXXDigitDate methods.
  @param A 4-17 digit date in ARC style (<code>yyyy</code> to
  <code>yyyyMMddHHmmssSSS</code>) formatting.
  @return A Date object representing the passed String.
  @throws ParseException