code: public static Calendar decode(String s) {
          try {
              if (s.startsWith("D:"))
                  s = s.substring(2);
              GregorianCalendar calendar;
              int slen = s.length();
              int idx = s.indexOf('Z');
              if (idx >= 0) {
                  slen = idx;
                  calendar = new GregorianCalendar(new SimpleTimeZone(0, "ZPDF"));
              }
              else {
                  int sign = 1;
                  idx = s.indexOf('+');
                  if (idx < 0) {
                      idx = s.indexOf('-');
                      if (idx >= 0)
                          sign = -1;
                  }
                  if (idx < 0)
                      calendar = new GregorianCalendar();
                  else {
                      int offset = Integer.parseInt(s.substring(idx + 1, idx + 3)) * 60;
                      if (idx + 5 < s.length())
                          offset += Integer.parseInt(s.substring(idx + 4, idx + 6));
                      calendar = new GregorianCalendar(new SimpleTimeZone(offset * sign * 60000, "ZPDF"));
                      slen = idx;
                  }
              }
              calendar.clear();
              idx = 0;
              for (int k = 0; k < DATE_SPACE.length; k += 3) {
                  if (idx >= slen)
                      break;
                  calendar.set(DATE_SPACE[k], Integer.parseInt(s.substring(idx, idx + DATE_SPACE[k + 1])) + DATE_SPACE[k + 2]);
                  idx += DATE_SPACE[k + 1];
              }
              return calendar;
          }
          catch (Exception e) {
              return null;
          }
      }
docs: Converts a PDF string representing a date into a Calendar.
  @param s the PDF string representing a date
  @return a <CODE>Calendar</CODE> representing the date or <CODE>null</CODE> if the string
  was not a date