Ejemplo n.º 1
0
  /**
   * Parses a string as a date
   *
   * @param str The string containing the date
   * @return The date value parsed from the string
   * @throws IOException If there's an error parsing the date
   */
  public Object parseDate(String str, DateFormat dateFormat) throws IOException {
    // If there isn't any, don't parse
    if (str == null) return null;

    try {
      return dateFormat.parse(str);
    } catch (ParseException exc) {
      throw new IOException("Error parsing date " + str);
    }
  }