{"record":{"id":"5f7d10583d68fa56","repo":"apache/dolphinscheduler","slug":"data-s-should-be-a-validate-data-string-yyyy-m","errorCode":null,"errorMessage":"data: %s should be a validate data string - yyyy-MM-dd HH:mm:ss ","messagePattern":"data: (.+?) should be a validate data string - yyyy-MM-dd HH:mm:ss ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java","lineNumber":231,"sourceCode":"            log.error(\"error while parse date:\" + date, e);\n        }\n        return null;\n    }\n\n    /**\n     * convert date str to yyyy-MM-dd HH:mm:ss format\n     *\n     * @param date date string\n     * @return yyyy-MM-dd HH:mm:ss format\n     */\n    public static @Nullable Date stringToDate(String date) {\n        return parse(date, YYYY_MM_DD_HH_MM_SS, null);\n    }\n\n    public static ZonedDateTime stringToZoneDateTime(@Nonnull String date) {\n        Date d = stringToDate(date);\n        if (d == null) {\n            throw new IllegalArgumentException(String.format(\n                    \"data: %s should be a validate data string - yyyy-MM-dd HH:mm:ss \",\n                    date));\n        }\n        return ZonedDateTime.ofInstant(d.toInstant(), ZoneId.systemDefault());\n    }\n\n    /**\n     * convert date str to yyyy-MM-dd HH:mm:ss format\n     *\n     * @param date     date string\n     * @param timezone\n     * @return yyyy-MM-dd HH:mm:ss format\n     */\n    public static Date stringToDate(String date, String timezone) {\n        return parse(date, YYYY_MM_DD_HH_MM_SS, timezone);\n    }\n\n    /**","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java#L213-L249","documentation":"DateUtils.stringToZoneDateTime first parses the input via stringToDate; if parsing fails it returns null, and this method then throws IllegalArgumentException with a formatted message showing the offending input and the expected pattern yyyy-MM-dd HH:mm:ss. It converts a validated date string into a ZonedDateTime in the system default zone.","triggerScenarios":"Calling stringToZoneDateTime with null-format data: an empty string, a string not matching \"yyyy-MM-dd HH:mm:ss\" (e.g. ISO with T and milliseconds \"2024-01-01T10:00:00\", date-only \"2024-01-01\", or a timestamp number as string), or a @Nonnull-annotated null argument.","commonSituations":"Workflow parameter/timing values pasted from the UI in a different locale format; frontend sending ISO-8601 strings; schedule start/end times stored as epoch millis being passed directly; user-defined dependent-task date parameters with typos.","solutions":["Format the input as \"yyyy-MM-dd HH:mm:ss\" before calling (e.g. \"2024-01-01 10:00:00\")","If the value is an epoch timestamp, convert with DateUtils.timestampToTimeZone/timestampToDate first instead of passing the raw number string","If the value is ISO-8601 with 'T', normalize: date.replace('T', ' ') and strip milliseconds/zone suffix, or parse it with java.time directly","Add a pre-check with DateUtils.stringToDate(date) != null before invoking stringToZoneDateTime to produce a clearer upstream error"],"exampleFix":"// before\nZonedDateTime zdt = DateUtils.stringToZoneDateTime(\"2024-01-01T10:00:00\");\n\n// after\nString normalized = input.replace('T', ' ').split(\"\\\\.\")[0];\nZonedDateTime zdt = DateUtils.stringToZoneDateTime(normalized); // \"2024-01-01 10:00:00\"","handlingStrategy":"validation","validationCode":"boolean isValidDateInput(String s) {\n    return s != null && s.matches(\"\\\\d{4}-\\\\d{2}-\\\\d{2} \\\\d{2}:\\\\d{2}:\\\\d{2}\") && DateUtils.stringToDate(s) != null;\n}","typeGuard":null,"tryCatchPattern":"try {\n    ZonedDateTime zdt = DateUtils.stringToZoneDateTime(input);\n} catch (IllegalArgumentException e) {\n    log.error(\"Bad date input '{}': expected yyyy-MM-dd HH:mm:ss\", input);\n}","preventionTips":["Normalize ISO-8601 inputs (replace 'T', strip millis/zone) before parsing","Always produce date strings through DateUtils.dateToString rather than ad-hoc formatting","Validate user-entered schedule parameters at the API boundary","Never pass epoch-millis numbers as strings to stringToZoneDateTime"],"tags":["date","parsing","format","illegal-argument"],"backgroundTag":"invalid-date-format","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}