{"record":{"id":"7de3b284ef2a8a4d","repo":"pentaho/pentaho-kettle","slug":"unknown-date-format","errorCode":null,"errorMessage":"Unknown date format.","messagePattern":"Unknown date format\\.","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/util/DateDetector.java","lineNumber":209,"sourceCode":"  public static String getDateFormatByRegex( String regex, String locale ) {\n    if ( locale != null && LOCALE_en_US.equalsIgnoreCase( locale ) ) {\n      return (String) DATE_FORMAT_TO_REGEXPS_US.getKey( regex );\n    }\n    return (String) DATE_FORMAT_TO_REGEXPS.getKey( regex );\n  }\n\n  /**\n   * \n   * @param dateString\n   *          date string for parse\n   * @return {@link java.util.Date} converted from dateString by detected format\n   * @throws ParseException\n   *           - if we can not detect date format for string or we can not parse date string\n   */\n  public static Date getDateFromString( String dateString ) throws ParseException {\n    String dateFormat = detectDateFormat( dateString );\n    if ( dateFormat == null ) {\n      throw new ParseException( \"Unknown date format.\", 0 );\n    }\n    return getDateFromStringByFormat( dateString, dateFormat );\n  }\n\n  /**\n   * \n   * @param dateString\n   *          date string for parse\n   * @return {@link java.util.Date} converted from dateString by detected format\n   * @throws ParseException\n   *           - if we can not detect date format for string or we can not parse date string\n   */\n  public static Date getDateFromString( String dateString, String locale ) throws ParseException {\n    String dateFormat = detectDateFormat( dateString, locale );\n    if ( dateFormat == null ) {\n      throw new ParseException( \"Unknown date format.\", 0 );\n    }\n    return getDateFromStringByFormat( dateString, dateFormat );","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/util/DateDetector.java#L191-L227","documentation":"DateDetector.getDateFromString(String) first detects the format of the input string via detectDateFormat. When no known pattern matches, it returns null and this ParseException 'Unknown date format.' is thrown at error offset 0.","triggerScenarios":"Passing a date string whose layout does not match any pattern in detectDateFormat (e.g. '2026/13/45', locale-formatted months, unexpected separators); empty or null date strings that detection cannot resolve.","commonSituations":"Parsing user-entered dates in Kettle Excel/CSV input; strings from external systems with unfamiliar date formats; non-Latin month names without locale support.","solutions":["Normalize the input string to a supported format (e.g. ISO yyyy-MM-dd) before calling getDateFromString","Check DateDetector supported patterns and add yours if extendable","Use getDateFromStringByFormat with an explicit format you know the data follows","Validate input first with isValidDate and handle invalid rows explicitly"],"exampleFix":"// before\nDate d = DateDetector.getDateFromString(userInput);\n// after\nif (!DateDetector.isValidDate(userInput)) { throw new IllegalArgumentException(\"Unsupported date: \" + userInput); }\nDate d = DateDetector.getDateFromStringByFormat(userInput, \"yyyy-MM-dd\");","handlingStrategy":"validation","validationCode":"if (dateString == null || dateString.trim().isEmpty()) throw new IllegalArgumentException(\"Date string empty\");\nif (!DateDetector.isValidDate(dateString)) throw new IllegalArgumentException(\"Unsupported date format: \" + dateString);","typeGuard":null,"tryCatchPattern":"try {\n  return DateDetector.getDateFromString(s);\n} catch (ParseException e) {\n  LOG.warn(\"Unparseable date '{}', using fallback\", s);\n  return null;\n}","preventionTips":["Normalize external date inputs to ISO-8601 before parsing","Pre-validate with DateDetector.isValidDate","Log unmatched formats to extend pattern coverage"],"tags":["date","parsing","validation"],"backgroundTag":"invalid-date-format","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}