apache/incubator-seata · error · DateTimeException
The time format does not match yyyy-MM-dd HH:mm:ss
Error message
The time format does not match yyyy-MM-dd HH:mm:ss
What it means
DateUtils.convertToTimeStampFromDateTime throws DateTimeException (wrapping DateTimeParseException) when the input cannot be parsed with the pattern 'yyyy-MM-dd HH:mm:ss'. The console MCP tools use it for time-range query parameters; the fixed 24-hour pattern means timezone offsets, 'T' separators, fractional seconds, or 12-hour clock values all fail.
Source
Thrown at console/src/main/java/org/apache/seata/mcp/core/utils/DateUtils.java:55
}
public static long convertToTimestampFromDate(String dateStr) {
if (!isValidDate(dateStr)) {
throw new DateTimeException("The time format does not match yyyy-MM-dd");
}
LocalDate date = LocalDate.parse(dateStr);
ZonedDateTime zonedDateTime = date.atStartOfDay(ZoneId.systemDefault());
return zonedDateTime.toInstant().toEpochMilli();
}
public static long convertToTimeStampFromDateTime(String dateTimeStr) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
try {
LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, formatter);
return dateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
} catch (DateTimeParseException e) {
throw new DateTimeException("The time format does not match yyyy-MM-dd HH:mm:ss", e);
}
}
public static String convertToDateTimeFromTimestamp(Long timestamp) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime;
try {
dateTime = Instant.ofEpochMilli(timestamp)
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
} catch (DateTimeException | ArithmeticException e) {
return "Parse Failed, please check that the timestamp is correct";
}
return dateTime.format(formatter);
}
public static boolean judgeExceedTimeDuration(Long startTime, Long endTime, Long maxDuration) {
if (endTime < startTime) throw new IllegalArgumentException("endTime must not be earlier than startTime");View on GitHub (pinned to e01f97c6db)
Solutions
- Format the parameter exactly as 'yyyy-MM-dd HH:mm:ss' with 24-hour clock, e.g. '2026-08-14 09:30:00'
- Convert ISO strings client-side before invoking the tool: replace 'T' with a space and drop millis/offset
- For date-only input use convertToTimestampFromDate instead
- Validate with a try-parse of DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") before calling
Example fix
// before
Long ts = DateUtils.convertToTimeStampFromDateTime("2026-08-14T09:30:00"); // throws
// after
Long ts = DateUtils.convertToTimeStampFromDateTime("2026-08-14 09:30:00"); // ok Defensive patterns
Strategy: validation
Validate before calling
private static final DateTimeFormatter F = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
try { LocalDateTime.parse(s, F); } catch (DateTimeParseException e) { throw new IllegalArgumentException("expected yyyy-MM-dd HH:mm:ss"); } Type guard
boolean isStrictDateTime(String s) { try { LocalDateTime.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); return true; } catch (DateTimeParseException e) { return false; } } Try / catch
try { ts = DateUtils.convertToTimeStampFromDateTime(s); } catch (DateTimeException e) { return toolError("Invalid datetime '" + s + "', expected yyyy-MM-dd HH:mm:ss"); } Prevention
- Normalize ISO-8601 input client-side: replace 'T' with space, strip millis/offset
- Always include seconds at 24-hour clock
- Pre-parse with the same formatter before invoking the tool
When it happens
Trigger: Calling convertToTimeStampFromDateTime with values like '2026-08-14T10:00:00', '2026-08-14 10:00' (missing seconds), '2026-08-14 22:30:00.123', or '2026-08-14 2pm'.
Common situations: ISO-8601 formatted timestamps from MCP clients (the 'T' separator is the most common culprit), second-precision omission, or passing a plain date where a full datetime is required.
Related errors
- The time format does not match yyyy-MM-dd
- MCP server properties not properly configured or unsupported
- No naming servers addr configured
- endTime must not be earlier than startTime
- No right to be identified
AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14).
Data as JSON: /api/errors/9f3b174a5edc22ff.
Report an issue: GitHub.